1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

Compare commits

..

127 Commits

Author SHA1 Message Date
ibs
d64e0bb6ac 0024743: checkshape ignores self-intersection of wires in specific case
seeking of topological intersect section were disable. if intersect point is found it isn't ignored in specific described in the issue case
2014-03-20 15:24:15 +04:00
bugmaster
61e348dab6 0024549: Faulty shape after IGES translation with xstep.cascade.unit set to M
pcurve as line isn't created to avoid incorrect parameterization
Test case for issue CR24549

Test cases were corrected according to their new behavior
2014-03-20 14:59:22 +04:00
duv
e6804ff7c0 0024687: TKOpenGl shader programs - same view state for different v3d views
OpenGl_ShaderManager::IsSameView() - add const
2014-03-20 14:40:25 +04:00
apn
1704c57631 Update test cases database
- bugs modalg_5 bug23954 -      Added test case for issue 23954
- bugs modalg_1 bug60776_1 -  Corrected square of shape and deleted appropriate TODO
- bugs moddata_1 bug13 -          Added check for the curve length obtained as a result of intersection
- feat featprism S2 -                     Corrected square of shape and deleted appropriate TODO
2014-03-20 14:22:54 +04:00
dln
47cbf13472 0024727: Convertation of the generic classes to the non-generic. Part 3
1) Generic class "Intf_InterferencePolyhedron" from "Intf" package converted to the non-generic class and moved to the "IntPatch" package. Name of this class was changed to "IntPatch_InterferencePolyhedron".

2) Generic class "MoniTool_Elem" from "MoniTool" package converted to the non-generic class "MoniTool_TransientElem".

3) Generic class "IntWalk_PWalking" from "IntWalk" package converted to the non-generic class. And internal class "TheInt2S" of "IntWalk_PWalking" moved from IntWalk_PWalking.cdl to IntWalk.cdl for correct building. Also several "*.cxx" files of this class merged to one ".cxx".

4) Generic class "Transfer_SimpleBinder" from "Transfer" package converted to the non-generic class and moved to the "TransferBRep" package. Name of this class was changed to "TransferBRep_BinderOfShape".

5) Generic class "Geom2dInt_CurveTool" from "Geom2dInt" package converted to the non-generic class "Geom2dInt_Geom2dCurveTool".

6) Generic class "MAT2d_BisectingLocus" from "MAT2d" package converted to the non-generic class and moved to the "BRepMAT2d" package. Name of this class was changed to "BRepMAT2d_BisectingLocus".

7) Generic class "MAT_Mat" from "MAT" package converted to the non-generic class and moved to the "MAT2d" package. Name of this class was changed to "MAT2d_Mat2d".
2014-03-20 14:14:41 +04:00
kgv
ebc93ae74f 0024737: Coding - remove <br> tag from header files
Eliminate #ifdefs around #includes, some unnecessary includes and macros
2014-03-20 14:12:58 +04:00
emv
df80c6ddda 0024706: Solids produced by BOP do not have flag Closed set in shells
Flag CLOSED is set for closed shells created during perform of Boolean Operation.
Test cases for issue CR24706
2014-03-20 14:10:33 +04:00
kgv
65b88edb4b 0024730: remove constructor for class TopOpeBRep_PointGeomTool 2014-03-20 14:07:41 +04:00
kgv
b56dd33fbd 0024736: There is new additional compilation warning on Linux platform 2014-03-20 14:06:19 +04:00
pkv
9873027959 0024733: Subshape IDs change between two executions of a same script
Changes:
1. class BOPTools_Set
   - method:
void BOPTools_Set::AddEdges(const TopoDS_Shape& aS)
has been removed as redundant

2. class BOPTools_Set
   - method:
Standard_Boolean BOPTools_Set::IsEqual  (const BOPTools_Set& theOther)const
has been modified to take into account Locations of the shapes

3. class BOPAlgo_Builder
   - method:
void BOPAlgo_Builder::FillSameDomainFaces()
has been modified in accordance with the modifications done in II.1.
2014-03-20 14:04:52 +04:00
kgv
679ecdeeac 0024637: Visualization - clean up implementation of rendering in immediate mode
Remove unused flag "DoubleBuf".
Remove Visual3d_TransientManager "class" (functionality moved to PrsMgr_PresentationManager).
Remove unused "Add" immediate mode.

V3d_View class - remove methods ::TransientManagerBeginDraw(), ::TransientManagerClearDraw(), ::TransientManagerBeginAddDraw().
Add method ::RedrawImmediate() to redraw only immediate presentations.

OpenGl_GraphicDriver - add methods ::DisplayImmediateStructure(), ::EraseImmediateStructure(), ::RedrawImmediate().
OpenGl_View - manage list of immediate structures.
OpenGl_Workspace - automate rendering workflow of immediate + persistent layers.

Merge PrsMgr_PresentationManager3d class into PrsMgr_PresentationManager.
Mark PrsMgr_PresentationManager3d as alias to PrsMgr_PresentationManager to simplify porting.

Prs3d_Presentation - remove unused field myStruct.
Prs3d_PresentationShadow - shadow link to existing presentation with custom attributes.
Graphic3d_Structure::Highlight() - do not register undisplayed structure in structure manager.

AIS_InteractiveContext, AIS_LocalContext add flag to prevent view update into methods
::MoveTo(), ::HilightNextDetected(), ::HilightPreviousDetected()
to allow update of customized immediate structures before redraw but after ::MoveTo().

Remove unused method AIS_InteractiveContext::Drag().

StdSelect_ViewerSelector3d do not user immediate mode in methods
::DisplayAreas(), ::ClearAreas(), ::ClearSensitive(), ::DisplaySensitive(),

GridEcho - update value in StdSelect_ViewerSelector3d::Pick() instead of V3d_View::Compute().
Do not use global variable for GridEcho vertex.
Redraw immediate mode not within GridEcho but at AIS_InteractiveContext, AIS_LocalContext layer.

V3d_View::ToPixMap() - disable autoupdate during FitAll.
Avoid Redraw() into FBO without ImmediateModeDrawToFront flag.

PrsMgr_PresentationManager stores list of temporary immediate presentations,
automatically cleared within BeginImmediateMode() call.
Methods with ambiguous names have been renamed
(new names now consistent with pre-existed method names in AIS_LocalContext class):
- BeginDraw -> BeginImmediateDraw
- EndDraw -> EndImmediateDraw
Remove now useless Remove() method (and ImmediateRemove() in AIS).

Visual3d_View now stores map of displayed immediate presentations.

ViewerTest_EventManager - eliminate double redraw in selection methods.

Fix warning
2014-03-20 13:54:55 +04:00
kgv
01ca42b2c1 0024732: OpenGl_Context - retrieve functions up to GL4.4
Drop unused OpenGl_ArbVBO.
Replace OpenGl_ExtFBO with OpenGl_ArbFBO.

OpenGl_Context - reorganize GL functions management.
OpenGl_GlFunctions structure now stores pointers for all GL functions,
while inheritors specify functions subset using access levels.
Drop fields core12, core13, core14; replace extFBO by arbFBO.

OpenGl_ArbIns, OpenGl_ArbTBO - use GL3.1 core functions
instead of ARB extensions when available.

OpenGl_ArbFBO - provide complete list of functions

OpenGl_GlCore11 - fix misprint

OpenGl_Context.hxx - remove redundant declarations
2014-03-20 13:51:05 +04:00
dbp
228de226a1 0024669: BVH binned builder fails to separate objects with the same center 2014-03-20 13:48:25 +04:00
apl
d399d3c36b 0024725: AIS_TexturedShape - flag switching texture modulation mode does not work
- Missing code restored
- "vtexture" command improved to support texture modulation option

remarks from kgv
2014-03-20 13:47:23 +04:00
aba
91b16a64ca 0024668: Null flyout value case in AIS_Dimension::SetTextPosition() method is not considered.
Corrected checks of working plane and dimension geometry.

Corrected remarks: IsComputed flag was added to the SelectionGeometry to check if it is filled; AdjustParameters() methods became const ones.

minor remark
2014-03-20 13:44:40 +04:00
apl
5432891550 0024728: A lot of tests are crashed on vdump command on Windows in debug mode 2014-03-20 13:42:09 +04:00
mkv
b4747b2976 0024493: Partition algorithm produces not valid shape(splt of 10 faces)
Test cases for issue CR24493
2014-03-20 13:40:55 +04:00
kgv
785a954097 0024644: Draw_Printer - provide the way to control messages gravity filter
Message_Printer - define GetTraceLevel()/SetTraceLevel() methods in base interface.
Implement message gravity filter in Draw_Printer.
Add new Draw Harness command dtracelevel to show/change message gravity filter.
Redirect default messenger to Draw_Printer within TKDraw instead of TKXSDRAW

Draw::Commands() - assign Draw_Printer only once
2014-03-20 13:39:21 +04:00
emv
0d19eb340e 0024696: Lower performance of the new Edge/Edge intersection algorithm
Performance improvements in IntTools_EdgeEdge algorithm:
1. Added check for common box between edges: if common box between edges is thin,
   find exact solutions at once, without looking for rough ranges first;
2. Improved methods IntTools_EdgeEdge::FindBestSolution() and
   IntTools_EdgeEdge::CheckCoincidence(...) by using method SplitRangeOnSegments
   with resolution of the curve as a criteria for size of the ranges.

Test cases for issue CR24696
2014-03-20 13:37:28 +04:00
bugmaster
fa84b8ffc4 Update cpulimit due to issue 24596 2014-03-14 14:16:51 +04:00
apl
9764ccbb78 0024720: Some standard samples are not compiled after latest integration to visualisation
Fixed compilation errors in samples:
mfc/standard
qt/Tutorial
qt/IESample
2014-03-13 17:41:37 +04:00
ama
7c8090aa6c 0024596: Slow import of IGES data
Part 1: Speed up of import functionality.
Correction in ShapeFix_IntersectionTool::FixIntersectingWires() - preliminary construction of ShapeAnalysis_Surface tool for the whole face; computation of 2d bounding boxes for edges and wires before intersection checking.

Part 2: Speed up of check shape.
Correction in BRepCheck_Face::IntersectWires() in the same way: preliminary computation of 2d boxes for edges and wires in order to reduce the number of calls of intersection tool for pair of wires.

Test cases for issue CR24596
2014-03-13 15:08:55 +04:00
abv
be8d29f50a 0024718: Broken build on VC8 (VS 2005) if TBB is used
Macro _WIN32_WINNT defined in OpenGl_SceneGeometry.cxx for building with TBB on VS 2005
2014-03-13 14:49:54 +04:00
kgv
63bcc44896 0024704: Visualization - inherit OpenGl_Structure from Graphic3d_CStructure
Graphic3d_Structure - store Graphic3d_CStructure as handle.
Graphic3d_Structure class implementation clean up.
Graphic3d_Structure::SetManager() - remove unused method.
Graphic3d_GraphicDriver - move structure-related methods to Graphic3d_CStructure interface.

Remove unsupported Aspect_TOHM_BLINK value.

Remove field-duplicate OpenGl_Structure::myClipPlanes

Fixing warnings
2014-03-13 14:48:38 +04:00
apl
3dfe95cdb9 0024714: Camera integration - difference in behavior of V3d_View::SetSize
Restored behavior of SetSize method
2014-03-13 14:32:43 +04:00
kgv
34db9c0093 0024688: Draw Harness - vdump command makes snapshot only for the first view 2014-03-13 14:27:58 +04:00
skv
2cd138b878 0024667: BRepOffsetAPI_MakePipe::FirstShape() and LastShape() return shapes not from result
Test case for issue CR24667
2014-03-13 14:25:14 +04:00
abv
cb389a77e4 0024710: Avoid including Handle_Class.hxx headers except where necessary
Includes of Handle*.hxx headers replaced by include of corresponding class (where possible without redesign of the classes).

Minor correction against compiler warning (vc10 64-bit) in BOPAlgo

Remove double header inclusions

Correction of minor mistake
2014-03-13 14:22:25 +04:00
kgv
519d35d81e 0024705: Draw Harness - add -noupdate option to vdisplay command
Add option to suppress viewer redraw to the following commands:
vdisplay, vdonly, verase, vremove
2014-03-13 14:18:10 +04:00
abk
db71702d4b 0024342: Create non-constant methods ChangeCoord with index parameter in classes gp_XY and gp_XYZ
The methods were created.
2014-03-13 13:34:23 +04:00
kgv
971c281b11 0024701: TKernel - drop redundant headers Standard_ctype.hxx and Standard_inverse.h 2014-03-13 13:24:31 +04:00
abv
3d68eaf52b 0024431: Using svg-images in the documentation
Documentation generator improved to automatically convert SVG images to PDF when PDF documents are generated. This is done with Inkscape thus it becomes necessary for generation of PDF documents.

Doxygen alias "figure" added for easy insertion of images with single command for both HTML and PDF output.

Documentation is updated.

Reviewed documentation.md and added more recommendations on Document Syntax.
Introduced existing svg images in the documentation.

Description of formatting of plain text, code blocks, and references revised.
Snapshot of structure of dox folder is updated.
Copyright year is corrected in PDF documents to be always the current one.

Some grammar corrections.
2014-03-13 13:21:24 +04:00
kgv
67335dfc1e 0024719: Snapshots for bugs/vis/bug6145 are unstable
Use "new" Boolean operation instead of "old" one.
2014-03-13 09:36:02 +04:00
kgv
f8eb9b179e 0024685: Coding Rules - "Draw:Atoi" misprints in the document 2014-03-06 16:01:49 +04:00
apl
197ac94e72 0024413: Visualization - get rid of projection shift from orthographic camera definition
From now on, the panning behavior of V3d_View completely corresponds to equal operations with camera. There is no more confusing "Center" property and "ProjectionShift" which were used to introduce composite panning, while respecting view referential points: At, Eye unchanged. The V3d_View::FitAll approach has been rewritten to do "fit all" geometrically, operating with frustum, to make it working for both orthographic and perspective projections.

1) Getting rid of ProjectionShift and Center property:
- Removed ProjectionShift property of Graphic3d_Camera.
- Removed confusing Center property of V3d_View (related to projection shift).
- Removed redundant code related to the Center property of V3d_View.
- Removed WindowLimit method of Graphic3d_Camera - no more used.

2) Improvements of fit all and selector:
- Improved FitAll operation of V3d_View and reused it in NIS_View - the perspective projection is now handled correctly.
- Revised code of Select3D_Projector class - can be defined with any given projection and model-view matrices.
- Modified StdSelect_ViewerSelector3d and ensured that panning, zooming and going into the view do not lead to unwanted re-projection of sensitives. The handling of perspective selection is revised.
- Take into account graphical boundaries of infinite structure on ZFitAll.

3) Improvements of camera:
- Introduced new z range scale parameter for V3d_View::AutoZFit. See, V3d_View::AutoZFitMode.
- Allow negative ZNear, ZFar for orthographic camera to avoid clipping of viewed model.
- Moved camera ZNear, ZFar validity checks to V3d_View level.
- Use more meaningful Standard_ShortReal relative precision for ZNear, ZFar ranges computed by ZFitAll.
- Use Standard_Real type for camera projection and orientation matrices.
- Extended camera to generate both Standard_Real and Standard_ShortReal transformation matrices using the same matrix evaluation methods and converted input parameters.

Correcting picking tests for perspective view

Modify v3d face test cases for 1px changes in face picking

Modified test cases for new arguments of vviewparams DRAWEXE command
2014-03-06 15:50:33 +04:00
ifv
e618b52683 0024650: Wrong intersection curves obtained for a surface of revolution and a plane.
Test case for issue CR24650
2014-03-06 15:50:31 +04:00
ibs
d16b64f1ec 0024679: test command doesn't work with tmp path containing white spaces 2014-03-06 15:50:30 +04:00
pkv
a942f2da6a 0024639: Parallelization FillDS part of BO
Edge/Edge Interferences

Changes:
1. class BOPAlgo_PaveFiller
  - method:
void BOPAlgo_PaveFiller::PerformEE()
the chages provides the parallel computations of
Edge/Edge interferences.

   - auxiliary classes:
    BOPAlgo_EdgeEdge
    BOPAlgo_EdgeEdgeFunctor
    BOPAlgo_EdgeEdgeCnt
have been added.
The classes are auxiliary classes to provide the parallel computations
of Edge/Edge interferences.

2. class BOPTest
-method:
void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
- static function:
Standard_Integer bfillds(Draw_Interpretor& di,
                         Standard_Integer n,
                         const char** a)
The syntax of the command "bfillds" has been changed.
> bfillds [-s -t]
options:
-s - launch the algorithm in sequential mode
-t - display CPU time

Test case for issue CR24639
2014-03-06 15:50:29 +04:00
emv
decdfc9499 0024628: Intersection result is unfixed
The map for collecting pave blocks of two faces has been replaced with indexed map
to ensure the constant order of pave blocks when checking section curves for existents.

Test case for issue CR24628
2014-03-06 15:50:28 +04:00
nbv
b92f35729a 0024612: Wrong pcurve of the section curve
Main changes are in "IntWalk_IWalking::TestDeflection(...)" function (IntWalk_IWalking_5.gxx).

Some test cases were corrected according to their new behavior.
2014-03-06 15:50:27 +04:00
emv
f10da91dab 0024673: Test cases for the new Edge/Edge intersection algorithm
New test cases for 0024673
Corrected names of shapes in test cases bugs/modalg_5/bug24208_1 - bug24208_14.
2014-03-06 15:50:26 +04:00
vro
5064550f11 0024675: Crash reading a VRML file
A node index for a normal is passed through a map of corrected references to node indices.

Test case for issue CR24675
2014-03-06 15:50:26 +04:00
dln
93cb31a607 0024662: Removing unused "generic" classes. Part 3
In scope of this issue next unused generic class will be removed:

- IntImp_CSCurveTool
- IntImp_CSFunction
- IntImp_CurveTool
- IntImp_ISurfaceTool
- IntImp_PSurfaceTool
- IntStart_ArcTool
- IntStart_PSurfaceTool
- IntStart_SIFunction
- IntStart_SITool
- IntStart_SOBFunction
- IntStart_SOBTool
- IntStart_TopolTool
- IntWalk_IWFunction
- IntWalk_Iterator
- IntWalk_LoopPointTool
- IntWalk_PSurfaceTool
- IntWalk_PathPointTool
- Intf_ToolPolyhedron
- LProp_CurveTool
- LProp_SurfaceTool
- LibCtl_ProtocolTemplate
- MAT_Tool
- Primitives_Builder
- Sweep_Builder
- Sweep_Iterator
- Sweep_Tool
- TopClass_FaceExplorer
- TopClass_Intersection2d
- HatchGen_Intersector
- IFSelect_SelectList
- IntCurveSurface_CurveTool
- IntImp_COnSCurveTool
- IntImpParGen_ParTool
2014-03-06 15:49:57 +04:00
kgv
8e3ebc7a63 0024672: Visualization - AIS_TexturedShape does not activate back face culling aspect 2014-03-06 15:48:04 +04:00
apl
f376ac72de 0024622: Add method to AIS_TexturedShape class to assign texture data directly from byte stream
Added methods to specify Image_PixMap as texture source to AIS_TexturedShape and Graphic3d_TextureRoot.
Modified internal class MeshVS_ImageTexture2D, originally used for the purpose of sourcing texture as Image_PixMap.

AIS_TexturedShape class:
- Get rid from cdl declaration.
- Remove unused and uninitialized field myDeflection / method Deflection().
- Improve class documentation.
- Use Graphic3d_NOT_2D_UNKNOWN instead of -1.
- Use myIsCustomOrigin and myToScale flags to use/ignore custom values.
2014-03-06 15:48:03 +04:00
apn
d53ae65f65 0022912: After calling AIS_InteractiveContext::UnsetColor objects are drawn with the same color when transparency is changed
Added test case bugs/vis/bug22912
2014-03-06 15:48:02 +04:00
dln
62684c43f6 0024663: Removing unused "generic" classes. Part 4
In scope of this issue next unused generic class will be removed:

- TCollection_AVLBaseNode
- TCollection_AVLIterator
- TCollection_AVLList
- TCollection_AVLNode
- TCollection_AVLSearchTree

- PCollection_ATInOrderIterator
- PCollection_ATPostOrderIterator
- PCollection_ATPreOrderIterator
- PCollection_AVLIterator
- PCollection_AVLNode
- PCollection_AdjacentVerticesIterator
- PCollection_BackEdgesIterator
- PCollection_BreadthFirstIterator
- PCollection_DepthFirstIterator
- PCollection_DoubleMapIterator
- PCollection_DoubleMapNode
- PCollection_Edge
- PCollection_EdgesIterator
- PCollection_FrontEdgesIterator
- PCollection_HAVLSearchTree
- PCollection_HArbitraryTree
- PCollection_HDirectedGraph
- PCollection_HDoubleMap
- PCollection_HQueue
- PCollection_HSet
- PCollection_HStack
- PCollection_LeavesIterator
- PCollection_QueueIterator
- PCollection_RootsIterator
- PCollection_SetIterator
- PCollection_StackIterator
- PCollection_Vertex
- PCollection_VerticesIterator
- PCollection_HDataMap
- PCollection_HIndexedDataMap
- PCollection_IndexedDataMapNode
- PCollection_MapIterator
- PCollection_MapNode
2014-03-06 15:47:44 +04:00
vro
d5c3f40613 0024645: Pointer to the last is wrong for a tree node
- An extra call to DownCast() is removed for a performance reason.
- Information on last child is added to the Dump() method + fixed a problem of lost last child tree node on removal (detach) operation.
- Test case for issue CR24645
2014-03-06 13:33:07 +04:00
osa
f8c8ba7a6d 0024671: TKOpenGl, OpenGl_Context - glGetPointerv might be called without GL context 2014-03-06 13:12:58 +04:00
abv
938bb74003 0024599: Tools for interacting with DRAW from Visual Studio debugger
Minor correction of #include to avoid dependency of package Draw on DBRep (problem building by WOK).
License statements in new files corrected for licensecheck command.
Non-ascii en-dash symbol repleced by Ascii hyphen in debug.md.
2014-03-03 14:52:56 +04:00
pkv
bf12f0763e 0024654: Result of Boolean operation is invalid for bopargcheck if rotated
class  BndLib
   - method:
void BndLib::Add(const gp_Hypr& H,
                 const Standard_Real P1,
                 const Standard_Real P2,
                 const Standard_Real Tol,
                 Bnd_Box& B)
  - static function:
Standard_Integer ComputeBox(const gp_Hypr& aHypr,
                            const Standard_Real aT1,
                            const Standard_Real aT2,
                            Bnd_Box& aBox)
The function computes bounding box for bounded hyperbola

Test case for issue CR24654
2014-02-27 18:51:55 +04:00
vro
ca2edbb237 0024666: Removal of output information in debug mode in Ocaf
DEB_BUILDER replaces DEB pre-processor directive to eliminate extra output on setting a shape to a label.
Small correction of test case
2014-02-27 18:49:28 +04:00
dln
89f18cb939 0024660: Removing unused "generic" classes. Part 1
In scope of this issue next unused generic classes will be removed:

1) AppBlend_Line

2) AppBlend_SectionGenerator

3) AppCont_SurfLeastSquare

4) AppCont_TheLineTool

5) AppCont_TheSurfTool

6) AppParCurves_MLineToo

7) AppParCurves_Projection

8) ApproxInt_WLine

9) Approx_ComputeCSurface

10) Approx_TheLineTool

11) Blend_Iterator

12) Contap_ArcTool

13) Contap_SurfaceTool

14) Contap_TopolTool

15) Dynamic_EnumerationParameter

16) Dynamic_MethodInstance

17) Extrema_ExtPSOfRev

18) GProp_CurveTool

19) GProp_DomainTool

20) GProp_FaceTool
2014-02-27 18:46:56 +04:00
nbv
67e1d45b60 0024575: Exception is raised during 'checkshape' operation.
Recursion calling of "Propagate(...)" function is replaced with cycle.
Test case for issue CR24575
2014-02-27 18:46:00 +04:00
vro
bf5b529346 0024645: Pointer to the last is wrong for a tree node
Information on last child is added to the Dump() method + fixed a problem of lost last child tree node on removal (detach) operation.
Test case for issue CR24645
2014-02-27 18:44:15 +04:00
kgv
49663e13f0 0024636: Coding Rules - define rules for development of Draw Harness commands
.md file corrected grammar, style and logic. Removed redundancies.
2014-02-27 18:42:20 +04:00
ibs
ca0f3082a0 0024659: misprints in draw documentation 2014-02-27 18:35:07 +04:00
ibs
e8181411e6 0024364: Document system should use local MathJax also
the new ability choosing of the location of MathJax was introduced
new argument was added to gendoc.bat script
MathJax choice was updated for CHM articles
Minor corrections of documentation
2014-02-27 18:34:02 +04:00
abv
d4faf9e945 0024599: Tools for interacting with DRAW from Visual Studio debugger
Global functions are added to allow a user performing DRAW commands from VS Command Window when DRAW is interrupted on a breakpoint.
Previously existing functions are adapted to work with Visual Studio debugger (Command Window).
A manual describing use of these functions and other debugging facilities and some hints is added to Developer Guides.
Minor corrections and refinement of debug.md.
2014-02-27 18:25:18 +04:00
pkv
c5face6f3a 0024655: Boolean common produces incorrect result
class BOPAlgo_WireSplitter
   - method:
void BOPAlgo_WireSplitter::SplitBlock
                 (const TopoDS_Face& myFace,
                   BOPTools_ConnexityBlock& aCB);

 - static functions:
void RefineAngles(const TopoDS_Face& myFace,
                  const BOPCol_ListOfShape& myEdges,
                  BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo& mySmartMap);

void RefineAngles(const TopoDS_Vertex& aV,
                  const TopoDS_Face& myFace,
                  const BOPCol_MapOfShape& aMBE,
                  BOPAlgo_ListOfEdgeInfo& aLEI);

Standard_Boolean RefineAngle2D(const TopoDS_Vertex& aV,
                               const TopoDS_Edge& aE,
                               const TopoDS_Face& myFace,
                               const Standard_Real aA1,
                               const Standard_Real aA2,
                               Standard_Real& aA);

The treatment p-curves convergent in node.
The refining the angles of p-curves taking into account
bounging curves if exist.

Test case for issue CR24655
2014-02-27 18:17:01 +04:00
apn
cc88c2f65b Deleted TODO which is not reproduced in Debug mode. 2014-02-21 11:50:37 +04:00
emv
1d18c75e70 0024648: Different types of intersection curves between Cone and Torus with a different order of arguments
Correct treatment of the cases with Cone and Torus.
Test cases for issue CR24648
2014-02-20 17:17:13 +04:00
pkv
6f31882ada 0024620: BOPAlgo_CheckerSI returns interferences that are not sub-shapes of the source shape
void BOPAlgo_CheckerSI::PrepareCopy()
has been added.
Purpose:
   - provides the copy of the argument
   - provides links between the copy and the original
- protected method:
void BOPAlgo_CheckerSI::PostTreatCopy()
has been added.
Purpose: provides post treat actions wit the copy.

void BOPAlgo_PaveFiller::Perform()
The try/catch mechanism is used inside the method

Standard_Integer bopcheck
  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
The redundant copying is removed.

Standard_Integer bopargcheck
  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
The redundant copying is removed.

packages:
BOPAlgo
BOPTest

Test cases for issue CR24620
Small correction of text case for issue CR24620
2014-02-20 17:10:47 +04:00
ifv
e16f61a62f 0024627: Extrema 2d between an arc of circle and an ellipse crashes
Test case for issue CR24627
2014-02-20 17:02:50 +04:00
pkv
362dec17cf 0024618: Embedding vertex in BOP depends on the order of arguments
Changes: class BOPDS_DS
   - method:
void BOPDS_DS::AloneVertices(const Standard_Integer theI,
                             BOPCol_ListOfInteger& theLI)const
The condition for DS-index of a vertex has been corrected

class BOPTools_AlgoTools3D
   - static function:
Standard_Boolean HasGeometry(const TopoDS_Shape& aS)
The returnig value  has been corrected for shapes of vertex type

Modified entities:
packages:
BOPDS
BOPTools

Test cases for issue CR24618
2014-02-20 16:56:10 +04:00
abv
1896126e35 0024635: Eliminate trivial compiler warnings by GCC in Debug mode 2014-02-20 16:45:06 +04:00
osa
03e04ead37 0024642: TKOpenGl, OpenGl_Text - rotation angle is ignored in case of 2D text 2014-02-20 16:38:55 +04:00
osa
6a240ff87d 0024641: TKOpenGl - public methods of OpenGl_Text and OpenGl_AspectText classes are not exported 2014-02-20 16:32:39 +04:00
abv
7eb732b683 0024640: Broken logic of check of variable for zero in IntCurvesFace_Intersector constructor
The check is fixed to avoid FPE division by zero
2014-02-20 16:25:53 +04:00
emv
ecba6de3cc 0024558: Boolean operation can not create all results solids which should be built.
Corrections in checking 2d distances when splitting wires.
Test case for the issue.
2014-02-20 16:18:59 +04:00
abv
d5f74e42d6 0024624: Lost word in license statement in source files
License statement text corrected; compiler warnings caused by Bison 2.41 disabled for MSVC; a few other compiler warnings on 54-bit Windows eliminated by appropriate type cast
Wrong license statements corrected in several files.
Copyright and license statements added in XSD and GLSL files.
Copyright year updated in some files.
Obsolete documentation files removed from DrawResources.
2014-02-20 16:15:17 +04:00
aml
9bd37e127c 0024530: TKMesh - remove unused package IntPoly
Deletion of package IntPoly.
2014-02-20 15:46:42 +04:00
apn
7075ef95b6 Update testing case for issue 0024499
Added XSDRAW instead of XDE
2014-02-17 12:48:34 +04:00
apn
69fd2d1b53 Added QA command OCC24086 and test case bugs/modalg_5/bug24086 for issue 24086. 2014-02-13 14:04:52 +04:00
apn
12fc400cf8 Added test case bugs/modalg_5/bug24074 for issue 24074. 2014-02-13 14:04:50 +04:00
apn
45f8c99462 Added test case bugs/step/bug24055 for issue 24055. 2014-02-13 14:04:49 +04:00
apn
01ee00d90b Added QA command OCC24051 and test case bugs/vis/bug24051 for issue 24051. 2014-02-13 14:04:47 +04:00
apn
1b7602c84a Added QA command OCC24012 and test case bugs/modalg_5/bug24012 for issue 24012. 2014-02-13 14:04:45 +04:00
apn
02fe718cde Added test case bugs/vis/bug23984 for issue 23984. 2014-02-13 14:04:44 +04:00
nbv
c2c2f2b62c 0024585: Wrong pcurve of the section curve
PCurve is extended to surface boundary forcefully.
It is made by finding some additional points (if it is possibly).
"bopcurves" DRAW-command returns number of found 3D-curves and (as an option) 2D-curve (see help for more detail information).

Test cases for issue CR24585
2014-02-13 14:04:42 +04:00
aba
8bb96a9760 0024358: TKV3d - connected structures are not re-computed on device lost
Graphic3d_StructureManager::ReComputeStructures() method was corrected to consider all child (connected) structures.
Corrected remarks: added image dump in test case; corrected method name.
2014-02-13 14:04:40 +04:00
duv
5495fa7e65 0024402: TKOpenGl - Implement clipping planes in Phong GLSL program
Limit number of lights (breaks compatibility with old hardware).
2014-02-13 14:04:39 +04:00
duv
816d03eef3 0024323: TKOpenGl - spot light sources are not handled in Phong GLSL program
Limit number of lights (breaks compatibility with old hardware).
2014-02-13 14:04:37 +04:00
apn
6b371aa564 0024499: fixshape produces inverted solid
Bug is not reproduced in current master IR-2014-02-06.
Test bugs/modalg_5/bug24499 was added.
2014-02-13 14:04:36 +04:00
jgv
f52d1b53c4 0024586: Pipe construction is failed
Test case for issue CR24586
2014-02-13 14:04:34 +04:00
aba
af203d549a 0024412: TKV3d, Dimensions - Possibility to customize text position was lost:
AIS_Dimension::GetTextPosition() and AIS_Dimension::SetTextPosition() methods were added.
Added possibility to set and unset text label alignment respectively to the attach points after text position changed.
Added test cases to check text positioning with dimension parameters and with setting 3D point.
Corrected DRAW commands vmovedim, vangledim, vdistdim, vradiusdim.
Corrections of AIS_Dimension::SetTextPosition(): aspect parameters are not changed inside it.
Layout mode was removed; test cases and vdimparams, vdimension  commands were corrected.
remarks: coding style, removing redundant code of LayoutMode enumeration.
2014-02-13 14:04:32 +04:00
dln
3b010a7435 0024547: Convertation of the generic classes to the non-generic (math).
- class "math_DoubleTab" was converted to the non-generic class. Some changes were made in the class "math_Matrix". And some stylish changes were made.

- class "math_SingleTab" was converted to the non-generic template class. And classes "math_Vector" and "math_IntegerVector" converted to the non-cdl, because they use template class "math_Vector". Some stylish changes were made.
2014-02-13 14:04:31 +04:00
abv
8cb69787f2 0024607: Fix some GCC compiler warnings
- enumeration value not handled in switch in Aspect_ColorScale.cxx, TNaming_DeltaOnModification.cxx
- comparison between signed and unsigned integer expressions in NIS_Triangulated.cxx, OSD_MAllocHook.cxx, RWStl.cxx
- static function defined or declared but not used in OpenGl_Workspace_2.cxx, ProjLib_ComputeApprox.cxx
2014-02-13 14:04:29 +04:00
szv
feb2743f11 0024603: The code in TCollection_AsciiString::Search* methods can be simplified
Small improvement in TCollection_AsciiString::Search.
2014-02-13 14:04:27 +04:00
mmv
97f7a9d875 0023427: Unused C-sources in OSD package
Deleted unused sources in OSD package
2014-02-13 14:04:01 +04:00
apn
38e756a1f1 Added test case demo/samples/raytrace that show raytrace mode. 2014-02-07 14:47:38 +04:00
apn
eb77c7dbd2 Added TODO in test case bugs/modalg_3/bug615 in Debug mode (test case is bad, but behavior changes). 2014-02-07 14:45:05 +04:00
apn
5291af9fd3 Return cpulimit TODOs because test case doesn't execute always (it crashes by cpulimit in Debug mode). 2014-02-07 14:42:56 +04:00
pkv
50ba108c2a 0024597: Missing internal vertex in the result of General Fuse Operation
Changes:
class BOPDS_DS
   - method:
void BOPDS_DS::Init()
   - method:
void BOPDS_DS::FaceInfoIn
  (const Standard_Integer theF,
   BOPDS_IndexedMapOfPaveBlock& theMPB,
   BOPCol_MapOfInteger& theMI)
Add the information about internal vertices on faces to the Data Structure

Test case for issue CR24597
2014-02-07 11:15:30 +04:00
pkv
4abae870a8 0023884: Boolean Fuse between two faces fails
fix for the bug v1
fix for the bug v1.1
Test case for issue CR23884
2014-02-07 11:15:28 +04:00
kgv
dda67c1ca2 0024202: Support class methods as callbacks for Draw Harness commands 2014-02-07 11:15:26 +04:00
ama
eddb9c7c00 0024591: Modification of tests in group "sewing"
Proper use of "freebounds" command in sewing testgrid: pload XSDRAW, reference data for checking free edges were added.
2014-02-07 11:15:25 +04:00
nbv
00302ba4e7 0024472: Wrong section curves
1. Checking, if intersection curve is collapsed, is added. (file GeomInt_LineConstructor.cxx)
2. Earlier, intersection line was considered as valid if only mid-point of every interval of this line is into two intersected surfaces (with given tolerance). That's no good because after inserting of new points, old points, which is considered as valid only because they are into beginning or into end of interval (therefore, they was not checked), moved to mid of interval and became invalid. Therefore, checking for first and last points was added. (file GeomInt_LineConstructor.cxx)
3. Intersection line became valid (see bug description) after adding of new additional points into it (file IntPatch_PrmPrmIntersection.cxx). Methods for finding and adding of new points were added. (file IntWalk_PWalking_1.gxx)
Some test cases were changed.
Test cases for issue CR24472
2014-02-07 11:15:22 +04:00
emv
ec0cdc0e65 0024208: Optimization of the edge-edge and edge-face intersection algorithms
New Edge/Edge intersection algorithm (based on the intersection between edges bounding boxes).
Small correction.
2014-02-07 11:15:21 +04:00
kgv
5322131bd1 0024590: Crash when processing OpenGl_BndBoxPrs objects
Eliminate TelType enumeration
Cosmetics, warnings
2014-02-06 11:02:53 +04:00
abv
f1a5afa25c 0024588: Fix some ICC warning fixes
Some of ICC warning fixes reported in 0024574 are fixed
Remove redundant ifdef
2014-02-06 10:59:05 +04:00
abv
124021462e 0024587: Separate TCL samples for ray tracing and creation of bottle
New sample created for ray tracing in DRAW: samples/tcl/raytrace.tcl, rendering OCCT bottle with glass on a rectangular table, with shadows and reflections (if OpenCL is available). Sample bottle.tcl retains only modeling part.
2014-02-06 10:56:16 +04:00
bugmaster
8b1ad7e012 Modified test case (increase cpulimit in Debug mode) 2014-01-31 12:56:09 +04:00
bugmaster
ee7b5544a9 Adjusting of testing case for current state of OCCT 2014-01-31 12:53:56 +04:00
szv
3c946c3825 0024523: Colors and layers are lost during loopback test (read-write-read)
Command XGetShapeColor corrected to return generic color
2014-01-31 12:48:31 +04:00
jgv
8a6db25a62 0024573: Wrong result of 2d-offset algorithm on customer's shape
Test cases for issue CR24573
2014-01-30 16:08:20 +04:00
apn
e226a50679 0024024: Slow import of specific STEP data
Added test case bugs/step/bug24024
2014-01-30 14:27:23 +04:00
kgv
6788f42398 0024555: Visualization - the same text is rendered with shift at second time
Font_FTFont::loadGlyph() - use the same flags as RenderGlyph(), FT_LOAD_NO_HINTING has been missed.

Test cases for issue CR24555
2014-01-30 14:20:31 +04:00
ibs
a5deedd07b 0024580: CMake doesn't unset becoming unused variables when 3rdparty's usage is switched off
unset becoming unused variables when freeimage, opencl, tbb and gl2ps are switched off
2014-01-30 14:07:04 +04:00
apn
d77256d181 0002793: BinOcaf: low performance saving documents with large attributes
Testing case bugs/caf/bug2793 was created.
2014-01-30 14:01:20 +04:00
pkv
682c9d0682 0024157: Parallelization of assembly part of BO
I. New features:
I.1 class BOPAlgo_ShellSplitter
The new class BOPAlgo_ShellSplitter has been added.
Purpose:  The class provides the splitting of the set of connected faces
	on separate loops

II. Changes:
II.1. class BOPAlgo_BuilderSolid
- method:
void BOPAlgo_BuilderSolid::PerformLoops()
the changes that provide parallel run the ShellSplitter algorithm have been done.

- method:
void BOPAlgo_BuilderSolid::PerformAreas()
the classification the grows and holes has been done using
the algorithm of unbalanced binary tree of overlapped bounding boxes
2014-01-30 13:58:37 +04:00
apl
51f8f60c7a 0024564: Select3D_SensitiveFace gives inaccurate picking depth for AIS_Plane (interior selection)
1) Used more accurate Select3D_SensitiveTriangulation instead of Select3D_SensitiveFace for rectangular sensitives in AIS_Plane::ComputeSelection, AIS_Dimension::ComputeSelection
2) Test case for CR24564
2014-01-30 13:39:14 +04:00
jgv
be7c077ac5 0024481: Test "Perform Infinite Point" provides wrong result for a solid
Test cases for issue CR24481
2014-01-30 13:38:07 +04:00
apl
f38896916f 0024569: AIS_InteractiveContext::Update(...) does not updates selection when changing AIS_Plane
1) Allow AIS_InteractiveContext::Update to check, re-project and recompute selection structures even if presentations are not "to be updated".
2) Test case bugs vis bug24569.

Small correction of test case for issue CR24569
2014-01-30 13:04:26 +04:00
nbv
a86d3ec04b 0024203: Command "sameparameter" in DRAW on attached edge set tolerance equal to 116.
Main problem:
Algorithm of locale extrema, which is called by "sameparameter" command, cannot find extrema because extremal point is far from initial point. Therefore, reparametrization of edge's curve (for same-parameter) cannot be made properly.

Solve:
Using of global extrema (see Approx_SameParameter.cxx).

As the given edge contains two 2d-curves and the second from them is problem, for select needed curve, an interface of "mk2dcurve" DRAW-command is changed. Now there can be used an index of curve (by default, index = 1, as earlier), see help for more detail information.

Test "heal advanced Z3":
Now checkshape finds only two invalid subshapes. Earlier, it found four subshapes. I think it is not regression. Therefore, test case was changed.

Tolerance reducing.

test
2014-01-30 13:01:08 +04:00
Roman Lygin
091232bae7 0023855: Old BOPs fail on Win7 64bit when using TBB
Minor code refactoring (readability)

Test case for issue CR23855
2014-01-30 12:59:32 +04:00
dbp
265d4508bd 0024503: TKOpenGl - Porting ray-tracing component on BVH package
Updated test case v3d/raytrace/bug24130. The new version checks correctness of shadows.
2014-01-30 12:55:06 +04:00
mkv
05d7de534a Draw command and test case for testing issue CR24533 2014-01-24 14:44:33 +04:00
bugmaster
82e10785dd Deleted TODO in unstable test case in Debug mode. 2014-01-24 13:57:48 +04:00
duv
b5ac8292b0 0024001: Stereographic rendering support
Deleted TODOs which were used when branch was built without OpenCL.
Modified test case bugs/vis/bug23747_2 (changed textured shape)
2014-01-23 14:46:06 +04:00
dln
1190746b3c 0024552: Convertation of the generic classes to the non-generic (BndLib).
Package "BndLib":
Functionality of the files "BndLib_Compute.gxx", "BndLib_Compute2d.cxx" and "BndLib_Compute3d.cxx" (methods Compute(...) for 2d and 3d cases) moved to BndLib.cxx (to the template method Compute(...)). For that had to edit work with points and coordinates a little i.e. method Compute(...) was updated and some methods where Compute(..) is called in "BndLib.cxx".
2014-01-23 13:51:34 +04:00
Roman Lygin
4d9421a970 0024533: Use 0 to check null handle instead of UndefinedHandleAccess
Handle classes now use 0 as invalid value for pointer instead of custom (and platform-dependent) value like 0xfefd0000.
Compiler macros UndefinedHandleAddress and _OCC64 are eliminated.
2014-01-23 13:38:45 +04:00
gka
545ef510a7 0024517: Crash at StepToTopoDS_TranslateEdge::Init()
Fixed crash at StepToTopoDS_TranslateEdge::Init() for case when curve is absent)

Corrected error message for case of absence geom curve in edge curve
2014-01-23 13:36:55 +04:00
dln
3804f298a1 0024545: Convertation of the generic classes to the non-generic (XmlObjMgt).
In the package "XmlObjMgt" class "XmlObjMgt_Array1" was converted to the non-generic.
And some changes were made in "XmlNaming" package for correct compilation of the application.
2014-01-23 11:41:39 +04:00
kgv
cb78155f10 0024453: TKViewerTest - extend information provided by vstate command 2014-01-23 11:39:17 +04:00
abv
73ccc151fd 0024536: GCC compiler warning on breakage of pointer aliasing rules in BRepFill_Evolved.cxx
Avoid storing result of call to TopoDS::Edge() as reference
2014-01-23 11:37:32 +04:00
dbp
861a7b03e1 0024479: Ray Tracing mode does not work in Qt IE sample
Implementation of  Ray Tracing mode in standard Qt sample
Fix compile warnings in Qt samples.
Fix tabs in Common-string.ts.
Update Code style.

0024415: Update QT samples
Code which was based on QT3 was removed. Some bugs and warnings has been also fixed.
Porting from QT4 to QT5 sample files.
2014-01-22 19:09:00 +04:00
14576 changed files with 85669 additions and 113471 deletions

View File

@@ -69,10 +69,6 @@ else()
SET(COMPILER ${CMAKE_GENERATOR})
endif()
if (${COMPILER_BITNESS} STREQUAL 64)
add_definitions(-D_OCC64)
endif()
add_definitions(-DCSFDB)
if(WIN32)
add_definitions(/DWNT -wd4996)
@@ -213,6 +209,19 @@ SET(USE_OPENCL OFF CACHE BOOL "whether use OpenCL or not")
SET(INSTALL_TESTS OFF CACHE BOOL "Is tests copy to install directory")
MACRO (CHECK_AND_UNSET VARNAME)
IF(DEFINED ${VARNAME})
UNSET(${VARNAME} CACHE)
ENDIF()
ENDMACRO()
MACRO (CHECK_AND_UNSET_GROUP VARNAME)
CHECK_AND_UNSET ("${VARNAME}_DIR")
CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
CHECK_AND_UNSET ("${VARNAME}_DLL")
CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
ENDMACRO()
MACRO(THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME)
IF(NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
SET(3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "Directory contains ${PRODUCT_NAME} product")
@@ -386,12 +395,20 @@ IF(USE_FREEIMAGE)
THIRDPARTY_PRODUCT("FREEIMAGEPLUS" "FreeImagePlus.h" "freeimageplus${BUILD_SUFFIX}")
ENDIF()
ELSE()
CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE")
CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS")
CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS")
ENDIF()
# GL2PS
IF(USE_GL2PS)
ADD_DEFINITIONS(-DHAVE_GL2PS)
THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps${BUILD_SUFFIX}")
ELSE()
CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
CHECK_AND_UNSET ("INSTALL_GL2PS")
ENDIF()
# OPENCL
@@ -422,6 +439,11 @@ IF(USE_OPENCL)
# if CL/cl.h isn't found (and 3RDPARTY_OPENCL_INCLUDE_DIR isn't defined)
# then try to find OpenCL/cl.h (all other variable won't be changed)
THIRDPARTY_PRODUCT("OPENCL" "OpenCL/cl.h" "OpenCL${BUILD_SUFFIX}")
ELSE()
CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
CHECK_AND_UNSET ("INSTALL_OPENCL")
ENDIF()
# TBB
@@ -439,6 +461,11 @@ IF (USE_TBB)
GET_FILENAME_COMPONENT(3RDPARTY_TBB_DLL_DIR "${3RDPARTY_TBB_DLL}" PATH)
GET_FILENAME_COMPONENT(3RDPARTY_TBB_MALLOC_DLL_DIR "${3RDPARTY_TBB_MALLOC_DLL}" PATH)
ENDIF()
ELSE()
CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB_MALLOC")
CHECK_AND_UNSET ("3RDPARTY_TBB_DIR_NAME")
CHECK_AND_UNSET ("INSTALL_TBB")
ENDIF()
string( REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")

View File

@@ -156,7 +156,6 @@ p IntCurvesFace
p IntImp
p IntImpParGen
p IntPatch
p IntPoly
p IntPolyh
p IntRes2d
p IntStart

View File

@@ -38,6 +38,7 @@ dev_guides/contribution/coding_rules.md
dev_guides/contribution_workflow/contribution_workflow.md
dev_guides/git_guide/git_guide.md
dev_guides/tests/tests.md
dev_guides/debug/debug.md
dev_guides/cdl/cdl.md
dev_guides/wok/wok.md

View File

@@ -3,46 +3,47 @@ Coding Rules {#dev_guides__coding_rules}
@tableofcontents
@section OCCT_RULES_SECTION_1 Introduction
@section occt_coding_rules_1 Introduction
The purpose of this document is to define and formalize one style of programming for developers working on Open CASCADE Technology.
The establishment of a common style facilitates understanding and maintaining code developed by more than one programmer as well as making it easier for several people to co-operate in the development of the same framework.
In addition, following a common programming style enables the construction of tools that incorporate knowledge of these standards to help in the programming task.
Using a consistent coding style throughout a particular module, package, or project is important because it allows people other than the author, and the author himself, to easily understand and (hopefully) maintain the code.
Most programming styles are somewhat arbitrary, and this one is no exception. Some guidelines have been excerpted from the public domain of widely accepted practices.
This suggests that the guide will continue to evolve over time as new ideas and enhancements are added.
The purpose of this document is to define a common programming style for Open CASCADE Technology.
@subsection OCCT_RULES_SECTION_1_1 Scope of the rules in this document
The common style facilitates understanding and maintaining a code developed cooperatively by several programmers. In addition, it enables construction of tools that incorporate knowledge of these standards to help in the programming.
Rules in this document was written for C++ code.
However, with minor exceptions due to language restrictions, them should be applied to any sources in Open CASCADE Technology framework, including:
OCCT programming style follows common and appropriate best practices, so some guidelines have been excerpted from the public domain.
The guide can be improved in the future as new ideas and enhancements are added.
@subsection occt_coding_rules_1_1 Scope of the document
Rules in this document refer to C++ code. However, with minor exceptions due to language restrictions, they are applicable to any sources in Open CASCADE Technology framework, including:
- C/C++
- GLSL programs
- OpenCL kernels
- TCL scripts and test cases
@section OCCT_RULES_SECTION_2 Naming Conventions
@section occt_coding_rules_2 Naming Conventions
@subsection OCCT_RULES_SECTION_2_1 General naming rules
@subsection occt_coding_rules_2_1 General naming rules
The names considered in this section are mainly those which compound the interface to Open CASCADE Technology libraries as well as source code itself.
The names considered in this section mainly refer to the interface of Open CASCADE Technology libraries or source code itself.
### International language [MANDATORY]
All names are composed of English words and their abbreviations.
Open CASCADE Technology is an open source available for international community.
### Suggestive names
Names should be suggestive or, at least, contain a suggestive part.
Currently, there is no exact rule that would define how to generate suggestive names. However, usually names given to toolkits, packages, classes and methods are suggestive. Here are several examples:
- Packages containing words Geom or Geom2d in their names are related to geometrical data and operations.
- Packages containing words TopoDS or BRep in their names are related to topological data and operations.
- In OCAF, packages that define transient, persistent data classes and drivers to map between them, have similar names prefixed by 'T', 'P', and 'M' correspondingly (e.g. TDocStd, PDocStd, MDocStd).
- Packages ending with ...Test define Draw Harness plugins.
- Methods starting with Get... and Set... are usually responsible for (accordingly) retrieving/storing some data.
Open CASCADE Technology is an open source platform available for an international community, thus all names need to be composed of English words or their abbreviations.
### Meaningful names
Names should be meaningful or, at least, contain a meaningful part. To better understand this requirement, let us examine the existing names of toolkits, packages, classes and methods:
- Packages containing words *Geom* or *Geom2d* in their names are related to geometrical data and operations.
- Packages containing words *TopoDS* or *BRep* in their names are related to topological data and operations.
- In OCAF, packages that define transient, persistent data classes and drivers to map between them, have similar names prefixed by *T*, *P*, and *M* correspondingly (e.g. *TDocStd*, *PDocStd*, *MDocStd*).
- Packages ending with <i>...Test</i> define Draw Harness plugins.
- Methods starting with *Get...* and *Set...* are usually responsible for correspondingly retrieving and storing data.
### Related names
Names that define logically connected functionality should have the same prefix (start with the same letters) or, at least, have any other common part in them.
As an example the method GetCoord can be given. It returns a triple of real values and is defined for directions, vectors and points. The logical connection is obvious.
Names related to a logically connected functionality should have the same prefix (start with the same letters) or, at least, have any other common part.
For example, method *GetCoord* returns a triple of real values and is defined for directions, vectors and points. The logical connection is obvious.
### Camel Case style
Camel Case style is preferred for names.
@@ -54,46 +55,50 @@ Standard_Integer width_of_box; // this is bad
Standard_Integer aWidthOfBox; // this is OK
~~~~~
@subsection OCCT_RULES_SECTION_2_2 Names of development units
Usually unit (e.g. package) is a set of classes, methods, enumerations or any other sources implementing certain common functionality which, to the certain extent, is self contained and independent from other parts of library.
@subsection occt_coding_rules_2_2 Names of development units
### Underscores in units names [MANDATORY]
Names of units should not contain underscores, except cases where usage of underscores is allowed explicitly.
Usually names of files consisting Open CASCADE Technology are constructed according to the rules defined in the appropriate sections of this document.
Usually a unit (e.g. a package) is a set of classes, methods, enumerations or any other sources implementing a common functionality, which is self-contained and independent from other parts of the library.
### No underscores in unit names [MANDATORY]
Names of units should not contain underscores, unless the use of underscores is allowed explicitly.
### File name extensions [MANDATORY]
### File names extensions [MANDATORY]
The following extensions should be used for source files, depending on their type:
.cdl - CDL declaration files
.cxx - C++ source files
.hxx - C++ header files
.lxx - headers with definitions of inline methods (CDL packages)
* <i>.cdl</i> - CDL declaration files
* <i>.cxx</i> - C++ source files
* <i>.hxx</i> - C++ header files
* <i>.lxx</i> - headers with definitions of inline methods (CDL packages)
@subsection OCCT_RULES_SECTION_2_3 Names of toolkits
### Prefix for toolkit names [MANDATORY]
The following rules are usually used in naming of toolkits:
### Prefix for toolkits names [MANDATORY]
Toolkits names are prefixed by TK, followed by suggestive part of name explaining the domain of functionality covered by the toolkit (e.g. TKOpenGl).
Toolkit names are prefixed by *TK*, followed by a meaningful part of the name explaining the domain of functionality covered by the toolkit (e.g. *TKOpenGl*).
### Names of classes
Usually source files located in the unit have names that start from the name of the unit, separated from remaining part of file name (if any) by underscore "_".
For instance, names of files containing sources of C++ classes are constructed according to the following template.
### Naming of C++ class files
The following template should be used for names of files containing sources of C++ classes:
Usually the names of source files located in a unit start from the unit name separated from the other part of the file name by underscore "_".
<unit-name>_<class-name>.cxx (.hxx, .cdl etc.)
Thus, the names of files containing sources of C++ classes that belong to a package are constructed according to the following template:
Files that contain sources related to whole unit are called by the name of unit with appropriate extension.
~~~~~
<package-name>_<class-name>.cxx (or .hxx, or .cdl)
~~~~~
For example, file *Adaptor2d_Curve2d.cxx* belongs to the package *Adaptor2d*
Files that contain sources related to the whole unit are called by the unit name with appropriate extension.
### Names of functions
The term 'function' here is defined as:
The term **function** here is defined as:
- Any class method
- Any package method
- Any non-member procedure or function
It is preferred to name public methods from upper case, while protected and private methods from low case.
It is preferred to start names of public methods from an upper case character and to start names of protected and private methods from a lower case character.
~~~~~{.cpp}
class MyPackage_MyClass
@@ -111,12 +116,15 @@ private:
};
~~~~~
@subsection OCCT_RULES_SECTION_2_4 Names of variables
There are several rules that describe currently accepted practice used for naming variables.
@subsection occt_coding_rules_2_3 Names of variables
There are several rules that describe currently accepted practices for naming variables.
### Naming of variables
Name of variable should not conflict with the global names (packages, macros, functions, global variables etc.), either existing or possible.
The name of variable should not start with underscore(s).
Name of a variable should not conflict with the existing or possible global names (for packages, macros, functions, global variables, etc.).
The name of a variable should not start with an underscore.
See the following examples:
@@ -129,7 +137,8 @@ Standard_Integer THE_KERNEL = 0; // this is OK
~~~~~
### Names of function parameters
The name of a function (procedure, class method) parameter should start with 'the' followed by the rest of the name starting with capital letter.
The name of a function (procedure, class method) parameter should start with prefix *the* followed by the meaningful part of the name starting with a capital letter.
See the following examples:
@@ -140,7 +149,8 @@ void Package_MyClass::MyFunction (const gp_Pnt& thePoint); // this is preferred
~~~~~
### Names of class member variables
The name of a class member variable should start with 'my' followed by the rest of the name (rule for suggestive names applies) starting with capital letter.
The name of a class member variable should start with prefix *my* followed by the meaningful of the name starting with a capital letter.
See the following examples:
@@ -151,9 +161,9 @@ Standard_Integer myCounter; // This is preferred
~~~~~
### Names of global variables
It is strongly recommended to avoid defining any global variables.
However, as soon as global variable is necessary, the following rule applies.
Global variable name should be prefixed by the name of a class or a package where it is defined followed with '_my'.
However, as soon as a global variable is necessary, its name should be prefixed by the name of a class or a package where it is defined followed with *_my*.
See the following examples:
@@ -162,7 +172,7 @@ Standard_Integer MyPackage_myGlobalVariable = 0;
Standard_Integer MyPackage_MyClass_myGlobalVariable = 0;
~~~~~
Static constants within the file should be spelled upper-case and started with 'THE_' prefix:
Static constants within the file should be written in upper-case and begin with prefix *THE_*:
~~~~~{.cpp}
namespace
{
@@ -171,10 +181,12 @@ namespace
~~~~~
### Names of local variables
Local variable name should be constructed in such way that it can be distinguished from the name of a function parameter, a class member variable and a global variable.
It is preferred to prefix local variable names with 'a' and 'an' (also 'is', 'to' and 'has' for Boolean variables).
See the following examples:
The name of a local variable should be distinguishable from the name of a function parameter, a class member variable and a global variable.
It is preferred to prefix local variable names with *a* and *an* (or *is*, *to* and *has* for Boolean variables).
See the following example:
~~~~~{.cpp}
Standard_Integer theI; // this is bad
@@ -184,8 +196,9 @@ Standard_Integer anIndex; // this is OK
~~~~~
### Avoid dummy names
Avoid dummy names like I, j, k. Such names are meaningless and easy to mix up.
Code becomes more and more complicated when such dummy names used multiple times in code with different meaning, in cycles with different iteration ranges and so on.
Avoid dummy names, such as <i>i, j, k</i>. Such names are meaningless and easy to mix up.
The code becomes more and more complicated when such dummy names are used there multiple times with different meanings, or in cycles with different iteration ranges, etc.
See the following examples for preferred style:
@@ -207,31 +220,37 @@ void Average (const Standard_Real** theArray,
}
~~~~~
@section OCCT_RULES_SECTION_3 Formatting rules
@section occt_coding_rules_3 Formatting rules
In order to improve the open source readability and, consequently, maintainability, the following set of rules is applied.
To improve the open source readability and, consequently, maintainability, the following set of rules is applied.
### International language [MANDATORY]
All comments in all sources must be in English.
### Line length
In all sources try not to exceed 120 characters limit of line length.
Try to stay within the limit of 120 characters per line in all sources.
### C++ style comments
Prefer C++ style comments in C++ sources.
### Commenting out unused code
Delete unused code instead of commenting it or using #define.
### Indentation in sources [MANDATORY]
Indentation in all sources should be set to two space characters.
Use of tabulation characters for indentation is disallowed.
### Separating spaces
Punctuation rules follow the rules of English.
C/C++ reserved words, commas, colons and semicolons should be followed by a space character if they are not at the end of line.
There should be no space characters after '(' and before ')'. Closing and opening brackets should be separated by a space character.
For better readability it is also recommended to surround conventional operators by a space character. See the following examples:
Punctuation rules follow the rules of the English language.
* C/C++ reserved words, commas, colons and semicolons should be followed by a space character if they are not at the end of a line.
* There should be no space characters after '(' and before ')'. Closing and opening brackets should be separated by a space character.
* For better readability it is also recommended to surround conventional operators by a space character. See the following examples:
~~~~~{.cpp}
while (true) // NOT: while( true ) ...
@@ -245,7 +264,9 @@ for (anIter = 0; anIter < 10; ++anIter) // NOT: for (anIter=0;anIter<10;++anIter
~~~~~
### Separate logical blocks
Separate logical blocks of code with one blank line and comments.
See the following example:
~~~~~{.cpp}
@@ -268,8 +289,10 @@ if (anArgsNb < 3 || isSmthInvalid)
Notice that multiple blank lines should be avoided.
### Separate function bodies [MANDATORY]
Use function descriptive blocks to separate function bodies from each other.
Each descriptive block should contain at least a function name and description of purpose.
Each descriptive block should contain at least a function name and purpose description.
See the following example:
~~~~~{.cpp}
@@ -293,8 +316,9 @@ void TellMeSmthBad()
~~~~~
### Block layout [MANDATORY]
Figure brackets '{', '}' and each operator (for, if, else, try, catch) should be on dedicated line.
General block should have layout similarly to the following:
Figure brackets <i>{ }</i> and each operator <i>(for, if, else, try, catch)</i> should be written on a dedicated line.
In general, the layout should be as follows:
~~~~~{.cpp}
while (expression)
@@ -303,10 +327,11 @@ while (expression)
}
~~~~~
Entering block increases and leaving block decreases indentation to one tabulation.
Entering a block increases and leaving a block decreases the indentation by one tabulation.
### Single-line operators
Single-line conditional operator (if, while, for etc.) can be written without brackets on the following line.
Single-line conditional operators <i>(if, while, for,</i> etc.) can be written without brackets on the following line.
~~~~~{.cpp}
if (!myIsInit) return Standard_False; // bad
@@ -320,10 +345,11 @@ if (!theAlgo.IsNull()) // preferred
}
~~~~~
Code on the same line is less convenient for debugging.
Having all code in the same line is less convenient for debugging.
### Use alignment
Use alignment wherever it enhances readability. See the following example:
### Alignment
Use alignment wherever it enhances the readability. See the following example:
~~~~~{.cpp}
MyPackage_MyClass anObject;
@@ -339,8 +365,11 @@ switch (aVal)
~~~~~
### Indentation of comments
Comments should be indented similar to the code which they refer to or can be on the same line if they are short.
Text should be delimited with single space character from slash.
Comments should be indented in the same way as the code to which they refer or they can be in the same line if they are short.
The text of the comment should be separated from the slash character by a single space character.
See the following example:
~~~~~{.cpp}
@@ -354,8 +383,10 @@ while (expression) //bad comment
~~~~~
### Early return statement
Prefer early return condition rather than collecting indentations.
Better write like this:
Use an early return condition rather than collect indentations.
Write like this:
~~~~~{.cpp}
Standard_Integer ComputeSumm (const Standard_Integer* theArray,
@@ -372,7 +403,7 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray,
}
~~~~~
rather than:
Rather than:
~~~~~{.cpp}
Standard_Integer ComputeSumm (const Standard_Integer* theArray,
@@ -387,15 +418,18 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray,
}
~~~~~
to improve readability and reduce unnecessary indentation depth.
This helps to improve readability and reduce the unnecessary indentation depth.
### Trailing spaces
Trailing spaces should be removed when possible.
Spaces at end of line are useless and do not affect functionality.
Trailing spaces should be removed whenever possible.
Spaces at the end of a line are useless and do not affect functionality.
### Headers order
Split into groups: system headers, per framework headers, project headers; sort includes list alphabetically.
This rule can improve readability, allows detection of useless header's multiple inclusions and makes 3rd-party dependencies clearly visible.
Split headers into groups: system headers, headers per each framework, project headers; sort the list of includes alphabetically.
This rule improves readability, allows detecting useless multiple header inclusions and makes 3rd-party dependencies clearly visible.
~~~~~{.cpp}
// system headers
@@ -412,25 +446,28 @@ This rule can improve readability, allows detection of useless header's multiple
#include <NCollection_List.hxx>
~~~~~
@section OCCT_RULES_SECTION_4 Documentation rules
@section occt_coding_rules_4 Documentation rules
The source code is one of the most important references for documentation.
The comments in the source code should be complete enough to allow understanding of that code, and to serve as basis for other documents.
The main reasons why comments are regarded as documentation and should be maintained are:
The comments in the source code should be complete enough to allow understanding the corresponding code and to serve as basis for other documents.
- The comments are easy to reach - they are always together with source code
- It's easy to update description in the comment when source is modified
- The source itself represents a good context to describe various details that would require much more explanations in separate document
- As a summary, this is the most cost-effective documentation
The main reasons why the comments are regarded as documentation and should be maintained are:
- The comments are easy to reach - they are always together with the source code;
- It is easy to update a description in the comment when the source is modified;
- The source by itself is a good context to describe various details that would require much more explanations in a separate document;
- As a summary, this is the most cost-effective documentation.
The comments should be compatible with Doxygen tool for automatic documentation generation (thus should use compatible tags).
### Documenting classes [MANDATORY]
Each class should be documented in its header file (.hxx or .cdl).
The comment should give enough details for the reader to understand the purpose of the class and main way of work with it.
The comment should give enough details for the reader to understand the purpose of the class and the main way of work with it.
### Documenting class methods [MANDATORY]
Each class or package method should be documented in the header file (.hxx or .cdl).
The comment should explain the purpose of the method, its parameters, and returned value(s).
Accepted style is:
@@ -442,77 +479,97 @@ Standard_Export Standard_Real Square (Standard_Real theValue);
@endverbatim
### Documenting C/C++ sources
It is very desirable to put comments in the C/C++ sources of the package/class.
They should be detailed enough to allow any person to understand what does each part of code, and get familiar with it.
It is recommended to comment all static functions (like methods in headers), and at least each 10-100 lines of the function bodies.
There are also some rules that define how comments should be formatted, see section "Formatting Rules".
Following these rules is important for good comprehension of the comments;
moreover it makes possible to automatically generate user-oriented documentation directly from commented sources.
@section OCCT_RULES_SECTION_5 Application design
They should be detailed enough to allow any person to understand what each part of code does.
The following set of rules defines the common style which should be applied by any developer contributing to the open source.
It is recommended to comment all static functions (like methods in headers), and to insert at least one comment per each 10-100 lines in the function body.
There are also some rules that define how comments should be formatted, see <a href="#occt_coding_rules_3">Formatting Rules</a>.
Following these rules is important for good comprehension of the comments. Moreover, this approach allows automatically generating user-oriented documentation directly from the commented sources.
@section occt_coding_rules_5 Application design
The following rules define the common style, which should be applied by any developer contributing to the open source.
### Allow possible inheritance
### Allow for possible inheritance
Try to design general classes (objects) keeping possible inheritance in mind.
This rule means that making possible extensions of your class the user should not encounter with problems of private implementations.
This rule means that the user who makes possible extensions of your class should not encounter problems of private implementation.
Try to use protected members and virtual methods wherever you expect extensions in the future.
### Avoid friend declarations
Avoid using 'friend' classes or functions except some specific cases (ex., iteration) 'Friend' declarations increase coupling.
Avoid using 'friend' classes or functions except for some specific cases (for example, iteration) 'Friend' declarations increase coupling.
### Set/get methods
Avoid providing set/get methods for all fields of the class.
Intensive set/get functions break down encapsulation.
### Hiding virtual functions [MANDATORY]
Avoid hiding a base class virtual function by a redefined function with a different signature.
Most of the compilers issue warning on this.
### Avoid mixing error reporting strategies
Try not to mix different error indication/handling strategies (exceptions or returned values) on the same level of an application.
Try not to mix different error indication/handling strategies (exceptions or returned values) on the same application level.
### Minimize compiler warnings [MANDATORY]
When compiling the source pay attention to and try to minimize compiler warnings.
### Avoid unnecessary inclusion
Try to minimize compilation dependencies by removing unnecessary inclusion.
### Avoid unnecessary inclusions
@section OCCT_RULES_SECTION_6 General C/C++ rules
Try to minimize compilation dependencies by removing unnecessary inclusions.
This section defines rules for writing portable and maintainable C/C++ source code.
@section occt_coding_rules_6 General C/C++ rules
This section defines the rules for writing a portable and maintainable C/C++ source code.
### Wrapping of global variables [MANDATORY]
Use package or class methods returning reference to wrap global variables to reduces possible name space conflicts.
Use package or class methods returning reference to wrap global variables to reduce possible name space conflicts.
### Avoid private members
Use 'protected' members instead of 'private' wherever reasonable to enable future extensions.
Use 'private' fields if future extensions should be disabled.
Use *protected* members instead of *private* wherever reasonable to enable future extensions.
Use *private* fields if future extensions should be disabled.
### Constants and inlines over defines [MANDATORY]
Use constant variables (const) and inline functions instead of defines (#define).
### Avoid explicit numerical values [MANDATORY]
Avoid usage of explicit numeric values. Use named constants and enumerations instead.
Magic numbers are badly to read and maintain.
Numbers produce difficulties for reading and maintenance.
### Three mandatory methods
A class with any of (destructor, assignment operator, copy constructor) usually needs all of them.
If a class has a destructor, an assignment operator or a copy constructor, it usually needs the other two methods.
### Virtual destructor
A class with virtual function(s) ought to have a virtual destructor.
### Default parameter value
Do not redefine a default parameter value in an inherited function.
### Use const modifier
Use const modifier wherever possible (functions parameters, return values etc.)
Use *const* modifier wherever possible (functions parameters, return values, etc.)
### Usage of goto [MANDATORY]
Avoid goto statement except the cases where it is really needed.
Avoid *goto* statement unless it is really needed.
### Declaring variable in for() header
Declaring cycle variable in the header of the for() statement if not used out of cycle.
Declare a cycle variable in the header of the *for()* statement if not used out of cycle.
~~~~~{.cpp}
Standard_Real aMinDist = Precision::Infinite();
@@ -524,6 +581,7 @@ for (NCollection_Sequence<gp_Pnt>::Iterator aPntIter (theSequence);
~~~~~
### Condition statements within zero
Avoid usage of C-style comparison for non-boolean variables:
~~~~~{.cpp}
@@ -547,57 +605,70 @@ void Function (Standard_Integer theValue,
}
~~~~~
@section OCCT_RULES_SECTION_7 Portability issues
@section occt_coding_rules_7 Portability issues
This chapter contains rules that are critical for cross-platform portability.
### Ensure code portability [MANDATORY]
It is required that source code must be portable to all platforms listed in the official 'Technical Requirements'.
### Provide code portability [MANDATORY]
The source code must be portable to all platforms listed in the official 'Technical Requirements'.
The term 'portable' here means 'able to be built from source'.
The C++ source code should meet C++03 standard.
Any usage of compiler-specific features or further language versions (C++11, until all major compliers on all supported platforms do not implement all it features)
should be optional (escaped with appropriate preprocessor checks) and non-exclusive (alternative implementation should be provided, compatible with other compilers).
Any usage of compiler-specific features or further language versions (for example, C++11, until all major compilers on all supported platforms implement all its features) should be optional (used only with appropriate preprocessor checks) and non-exclusive (an alternative implementation compatible with other compilers should be provided).
### Avoid usage of global variables [MANDATORY]
Avoid usage of global variables. Usage of global variables may cause problems of accessing them from another shared library.
Instead of global variables, use global (package or class) functions that return reference to static variable local to this function.
Avoid usage of global variables. Usage of global variables may cause problems when accessed from another shared library.
Use global (package or class) functions that return reference to static variable local to this function instead of global variables.
Another possible problem is the order of initialization of global variables defined in various libraries that may differ depending on platform, compiler and environment.
### Avoid explicit basic types
Avoid explicit usage of basic types (int, float, double etc.), use Open CASCADE Technology types (from package Standard - see Standard_Integer, Standard_Real, Standard_ShortReal, Standard_Boolean, Standard_CString and others) or specific typedef instead.
### Use sizeof() to calculate sizes [MANDATORY]
Do not assume sizes of types. Use sizeof() instead to calculate sizes.
Avoid explicit usage of basic types (*int*, *float*, *double*, etc.), use Open CASCADE Technology types from package *Standard: Standard_Integer, Standard_Real, Standard_ShortReal, Standard_Boolean, Standard_CString* and others or a specific *typedef* instead.
### Empty line at end of file [MANDATORY]
In accordance with C++03 standard source files should be trailed by empty line.
### Use *sizeof()* to calculate sizes [MANDATORY]
Do not assume sizes of types. Use *sizeof()* instead to calculate sizes.
### Empty line at the end of file [MANDATORY]
In accordance with C++03 standard source files should be trailed by an empty line.
It is recommended to follow this rule for any plain text files for consistency and for correct work of git difference tools.
@section OCCT_RULES_SECTION_8 Stability issues
@section occt_coding_rules_8 Stability issues
The rules listed in this chapter are important for stability of the programs that use Open CASCADE Technology libraries.
### OSD::SetSignal() to catch exceptions
When using Open CASCADE Technology in an application, make sure to call OSD::SetSignal() function when the application is initialized.
This will install C handlers for run-time interrupt signals and exceptions,
so that low-level exceptions (such as access violation, division by zero etc.) will be redirected to C++ exceptions
(that use try {...} catch (Standard_Failure) {...} blocks).
### Use *OSD::SetSignal()* to catch exceptions
When using Open CASCADE Technology in an application, call *OSD::SetSignal()* function when the application is initialized.
This will install C handlers for run-time interrupt signals and exceptions, so that low-level exceptions (such as access violation, division by zero, etc.) will be redirected to C++ exceptions
that use *try {...} catch (Standard_Failure) {...}* blocks.
The above rule is especially important for robustness of modeling algorithms.
### Cross-referenced handles
Take care about cycling of handled references to avoid chains which will never be freed.
For that purpose, use a pointer at one (subordinate) side. See the following example:
In MyPackage.cdl:
Take care about cycling of handled references to avoid chains, which will never be freed. For this purpose, use a pointer at one (subordinate) side.
See the following example:
In *MyPackage.cdl* :
~~~~
class MyFirstHandle;
class MySecondHandle;
pointer MySecondPointer to MySecondHandle;
...
~~~~
In MyPackage_MyFirstHandle.cdl:
In *MyPackage_MyFirstHandle.cdl* :
~~~~
class MyFirstHandle from MyPackage
...
is
@@ -611,9 +682,11 @@ In MyPackage_MyFirstHandle.cdl:
mySecondPointer : MySecondPointer from MyPackage;
...
end MyFirstHandle from MyPackage;
~~~~
In MyPackage_MySecondHandle.cdl:
In *MyPackage_MySecondHandle.cdl* :
~~~~
class MySecondHandle from MyPackage
...
is
@@ -625,6 +698,7 @@ In MyPackage_MySecondHandle.cdl:
myFirstHandle : MyFirstHandle from MyPackage;
...
end MySecondHandle from MyPackage;
~~~~
In C++ code:
@@ -650,10 +724,11 @@ void MyFunction()
~~~~~
### C++ memory allocation
In C++ use new and delete operators instead of malloc() and free().
Try not to mix different memory allocation techniques.
### Match new and delete [MANDATORY]
In C++ use *new* and *delete* operators instead of *malloc()* and *free()*. Try not to mix different memory allocation techniques.
### Match *new* and *delete* [MANDATORY]
Use the same form of new and delete.
~~~~~{.cpp}
@@ -663,9 +738,11 @@ aPtr3 = Standard::Allocate (4096); ... ; Standard::Free (aPtr3);
~~~~~
### Methods managing dynamical allocation [MANDATORY]
Define a destructor, a copy constructor and an assignment operator for classes with dynamically allocated memory.
### Uninitialized variables [MANDATORY]
Every variable should be initialized.
~~~~~{.cpp}
@@ -673,15 +750,18 @@ Standard_Integer aTmpVar1; // bad
Standard_Integer aTmpVar2 = 0; // OK
~~~~~
Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is *guarantied* by following code.
Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code.
### Do not hide global new
Avoid hiding the global new operator.
### Do not hide global *new*
Avoid hiding the global *new* operator.
### Assignment operator
In operator=() assign to all data members and check for assignment to self.
In *operator=()* assign to all data members and check for assignment to self.
### Float comparison
Don't check floats for equality or non-equality; check for GT, GE, LT or LE.
~~~~~{.cpp}
@@ -691,42 +771,45 @@ if (Abs (theFloat1 - theFloat2) < theTolerance)
}
~~~~~
Package 'Precision' provides standard values for SI units and widely adopted by existing modeling algorithms:
- Precision::Confusion() for lengths in meters
- Precision::Angular() for angles in radians
Package *Precision* provides standard values for SI units and widely adopted by existing modeling algorithms:
as well as definition of infinity values within sanity range of double precision:
- Precision::Infinite()
- Precision::IsInfinite()
- Precision::IsPositiveInfinite()
- Precision::IsNegativeInfinite()
- *Precision::Confusion()* for lengths in meters;
- *Precision::Angular()* for angles in radians.
as well as definition of infinite values within normal range of double precision:
- *Precision::Infinite()*
- *Precision::IsInfinite()*
- *Precision::IsPositiveInfinite()*
- *Precision::IsNegativeInfinite()*
### Non-indexed iteration
Avoid usage of iteration over non-indexed collections of objects.
If such iteration is used, make sure that the result of the algorithm does not depend on order.
Since the order of iteration is unpredictable in this case, it frequently leads to different behavior of the application from one run to another,
thus embarrassing the debugging process.
It mostly concerns mapped objects for which pointers are involved in calculating the hash function.
For example, the hash function of TopoDS_Shape involves the address of TopoDS_TShape object.
Thus the order of the same shape in the TopTools_MapOfShape will vary in different sessions of the application.
Avoid usage of iteration over non-indexed collections of objects.
If such iteration is used, make sure that the result of the algorithm does not depend on the order of iterated items.
Since the order of iteration is unpredictable in case of a non-indexed collection of objects, it frequently leads to different behavior of the application from one run to another, thus embarrassing the debugging process.
It mostly concerns mapped objects for which pointers are involved in calculating the hash function. For example, the hash function of *TopoDS_Shape* involves the address of *TopoDS_TShape* object. Thus the order of the same shape in the *TopTools_MapOfShape* will vary in different sessions of the application.
### Do not throw in destructors
Do not throw from within destructor.
Do not throw from within a destructor.
### Assigning to reference [MANDATORY]
Avoid possible assignments of the temporary object to a reference.
Different behavior for different compiler of different platforms.
@section OCCT_RULES_SECTION_9 Performance issues
Avoid the assignment of a temporary object to a reference. This results in a different behavior for different compilers on different platforms.
@section occt_coding_rules_9 Performance issues
These rules define the ways of avoiding possible loss of performance caused by ineffective programming.
### Class fields alignment
In a class, declare its fields in the decreasing order of their size for better alignment.
Declare fields of a class in the decreasing order of their size for better alignment.
Generally, try to reduce misaligned accesses since they impact the performance (for example, on Intel machines).
### Fields initialization order [MANDATORY]
List class data members in the constructor's initialization list in the order they are declared.
~~~~~{.cpp}
@@ -752,7 +835,8 @@ private:
~~~~~
### Initialization over assignment
In class constructors prefer initialization over assignment.
Prefer initialization over assignment in class constructors.
~~~~~{.cpp}
MyPackage_MyClass()
@@ -763,8 +847,9 @@ MyPackage_MyClass()
~~~~~
### Optimize caching
When programming procedures with extensive memory access, try to optimize them in terms of cache behavior.
Here is an example of how cache behavior can be impact:
When programming procedures with extensive memory access, try to optimize them in terms of cache behavior. Here is an example of how the cache behavior can be impacted:
On x86 this code
~~~~~{.cpp}
@@ -775,7 +860,7 @@ for (Standard_Integer anIter = 0; anIter < 4096; ++anIter)
}
~~~~~
is more efficient than
is more efficient then
~~~~~{.cpp}
Standard_Real anArray[2][4096];
@@ -785,14 +870,103 @@ for (Standard_Integer anIter = 0; anIter < 4096; ++anIter)
}
~~~~~
since linear access (above) does not invalidate cache too often.
since linear access does not invalidate cache too often.
@section OCCT_RULES_SECTION_10 Examples
@section occt_coding_rules_10 Draw Harness command
Here is C++ source file sample:
Draw Harness provides TCL interface for OCCT algorithms.
There is no TCL wrapper over OCCT C++ classes, instead interface is provided through the set of TCL commands implemented in C++.
There is a list of common rules which should be followed to implement well-formed Draw Harness command.
### Return value
Command should return 0 in most cases even if the executed algorithm has failed. Returning 1 would lead to a TCL exception, thus should be used in case of a command line syntax error and similar issues.
### Validate input parameters
Command arguments should be validated before usage. The user should see a human-readable error description instead of a runtime exception from the executed algorithm.
### Validate the number of input parameters
Command should warn the user about unknown arguments, including cases when extra parameters have been pushed for the command with a fixed number of arguments.
~~~~~{.cpp}
if (theArgsNb != 3)
{
std::cout << "Syntax error - wrong number of arguments!\n";
return 1;
}
Standard_Integer anArgIter = 1;
Standard_CString aResName = theArgVec[anArgIter++];
Standard_CString aFaceName = theArgVec[anArgIter++];
TopoDS_Shape aFaceShape = DBRep::Get (aFaceName);
if (aFaceShape.IsNull()
|| aFaceShape.ShapeType() != TopAbs_FACE)
{
std::cout << "Shape " << aFaceName << " is empty or not a Face!\n";
return 1;
}
DBRep::Set (aResName, aFaceShape);
return 0;
~~~~~
### Message printing
Informative messages should be printed into standard output *std::cout*, whilst command results (if any) - into Draw Interpreter.
Information printed into Draw Interpreter should be well-structured to allow usage in TCL script.
### Long list of arguments
Any command with a long list of obligatory parameters should be considered as ill-formed by design.
Optional parameters should start with flag name (with '-' prefix) and followed by its values:
~~~~~{.tcl}
myCommand -flag1 value1 value2 -flag2 value3
~~~~~
### Arguments parser
- Integer values should be read using *Draw::Atoi()* function.
- Real values should be read using *Draw::Atof()* function.
- Flags names should be checked in case insensitive manner.
Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values in C-locale.
~~~~~{.cpp}
Standard_Real aPosition[3] = {0.0, 0.0, 0.0};
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
{
Standard_CString anArg = theArgVec[anArgIter];
TCollection_AsciiString aFlag (anArg);
aFlag.LowerCase(); //!< for case insensitive comparison
if (aFlag == "position")
{
if ((anArgIt + 3) >= theArgsNb)
{
std::cerr << "Wrong syntax at argument '" << anArg << "'!\n";
return 1;
}
aPosition[0] = Draw::Atof (theArgVec[++anArgIt]);
aPosition[1] = Draw::Atof (theArgVec[++anArgIt]);
aPosition[2] = Draw::Atof (theArgVec[++anArgIt]);
}
else
{
std::cout << "Syntax error! Unknown flag '" << anArg << "'\n";
return 1;
}
}
~~~~~
@section occt_coding_rules_11 Examples
### Sample documented class
@verbatim
//! Sample documented class
class Package_Class
{
@@ -803,21 +977,22 @@ public: //! @name public methods
//! @return squared value
Standard_Export Standard_Real Square (const Standard_Real theValue);
private: //! @name private methods
private: //! \@name private methods
//! Auxiliary method
void increment();
private: //! @name private fields
private: //! \@name private fields
Standard_Integer myCounter; //!< usage counter
};
@endverbatim
~~~~~{.cpp}
~~~~~
#include <Package_Class.hxx>
// ==========================================================
// function : Square
// purpose : Method computes the square value
@@ -838,7 +1013,8 @@ void Package_Class::increment()
}
~~~~~
TCL script for Draw Harness:
### TCL script for Draw Harness
~~~~~{.tcl}
# show fragments (solids) in shading with different colors
proc DisplayColored {theShape} {
@@ -872,7 +1048,7 @@ vfit
vdump $imagedir/${casename}.png 512 512
~~~~~
GLSL program:
### GLSL program:
~~~~~{.fs}
vec3 Ambient; //!< Ambient contribution of light sources
vec3 Diffuse; //!< Diffuse contribution of light sources

View File

@@ -0,0 +1,244 @@
Debugging tools and hints {#dev_guides__debug}
=========================
@tableofcontents
@section occt_debug_intro Introduction
This manual describes facilities included in OCCT to support debugging, and provides some hints for more efficient debug.
@section occt_debug_bop Self-diagnostics in Boolean operations algorithm
In real-world applications modeling operations are often performed in a long sequence, while the user sees only the final result of the whole sequence. If the final result is wrong, the first debug step is to identify the offending operation to be debugged further. Boolean operation algorithm in OCCT provides a self-diagnostic feature which can help to do that step.
This feature can be activated by defining environment variable *CSF_DEBUG_BOP*, which should specify an existing writeable directory.
The diagnostic code checks validity of the input arguments and the result of each Boolean operation. When an invalid situation is detected, the report consisting of argument shapes and a DRAW script to reproduce the problematic operation is saved to the directory pointed by *CSF_DEBUG_BOP*.
@section occt_debug_exceptions Calling JIT debugger on exception
On Windows platform when using Visual Studio compiler there is a possibility to start the debugger automatically if an exception is caught in a program running OCCT. For this, set environment variable *CSF_DEBUG* to any value. Note that this feature works only if you enable OCCT exception handler in your application by calling *OSD::SetSignal()*.
@section occt_debug_call Functions for calling from debugger
Modern interactive debuggers provide the possibility to execute application code at a program break point. This feature can be used to analyse the temporary objects available only in the context of the debugged code. OCCT provides several global functions that can be used in this way.
Note that all these functions accept pointer to variable as <i>void*</i> to allow calling the function even when debugger does not recognize type equivalence or can not perform necessary type cast automatically. It is responsibility of the developer to provide the correct pointer. In general these functions are not guaranteed to work, thus use them with caution and at your own risk.
@subsection occt_debug_call_draw Interacting with DRAW
Open CASCADE Test Harness or @ref user_guides__test_harness "DRAW" provides an extensive set of tools for inspection and analysis of OCCT shapes and geometric objects and is mostly used as environment for prototyping and debugging OCCT-based algorithms.
In some cases the objects to be inspected are available in DRAW as results of DRAW commands. In other cases, however, it is necessary to inspect intermediate objects created by the debugged algorithm. To support this, DRAW provides a set of commands allowing the developer to store intermediate objects directly from the debugger stopped at some point during the program execution (usually at a breakpoint).
~~~~~
const char* Draw_Eval (const char *theCommandStr)
~~~~~
Evaluates a DRAW command or script.
A command is passed as a string parameter.
~~~~~
const char* DBRep_Set (const char* theNameStr, void* theShapePtr)
~~~~~
Sets the specified shape as a value of DRAW interpreter variable with the given name.
- *theNameStr* - the DRAW interpreter variable name to set.
- *theShapePtr* - a pointer to *TopoDS_Shape* variable.
~~~~~
const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr)
const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr)
const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr)
~~~~~
Sets the specified geometric object as a value of DRAW interpreter variable with the given name.
- *theNameStr* - the DRAW interpreter variable name to set.
- *theHandlePtr* - a pointer to the geometric variable (Handle to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set.
- *thePntPtr* - a pointer to the variable of type *gp_Pnt* to be set.
- *thePnt2dPtr* - a pointer to the variable of type *gp_Pnt2d* to be set.
All these functions are defined in *TKDraw* toolkit and return a string indicating the result of execution.
@subsection occt_debug_call_brep Saving and dumping shapes and geometric objects
The following functions are provided by *TKBRep* toolkit and can be used from debugger prompt:
~~~~~
const char* BRepTools_Write (const char* theFileNameStr, void* theShapePtr)
~~~~~
Saves the specified shape to a file with the given name.
- *theFileNameStr* - the DRAW interpreter variable name to set.
- *theShapePtr* - a pointer to *TopoDS_Shape* variable.
~~~~~
const char* BRepTools_Dump (void* theShapePtr)
const char* BRepTools_DumpLoc (void* theShapePtr)
~~~~~
Dumps shape or its location to cout.
- *theShapePtr* - a pointer to *TopoDS_Shape* variable.
The following additional function is provided by *TKGeomBase* toolkit:
~~~~~
const char* GeomTools_Dump (void* theHandlePtr)
~~~~~
Dump geometric object to cout.
- *theHandlePtr* - a pointer to the geometric variable (<i>Handle</i> to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set.
@section occt_debug_vstudio Using Visual Studio debugger
@subsection occt_debug_vstudio_command Command window
Visual Studio debugger provides the Command Window (can be activated from menu <b>View / Other Windows / Command Window</b>), which can be used to evaluate variables and expressions interactively in a debug session (see http://msdn.microsoft.com/en-us/library/c785s0kz.aspx). Note that the Immediate Window can also be used but it has some limitations, e.g. does not support aliases.
When the execution is interrupted by a breakpoint, you can use this window to call the above described functions in context of the currently debugged function. Note that in most cases you will need to specify explicitly context of the function by indicating the name of the DLL where it is defined.
For example, assume that you are debugging a function, where local variable *TopoDS_Edge* *anEdge1* is of interest.
The following set of commands in the Command window will save this edge to file *edge1.brep*, then put it to DRAW variable *e1* and show it maximized in the axonometric DRAW view:
~~~~~
>? ({,,TKBRep.dll}BRepTools_Write)("d:/edge1.brep",(void*)&anEdge1)
0x04a2f234 "d:/edge1.brep"
>? ({,,TKDraw.dll}DBRep_Set)("e1",(void*)&anEdge1)
0x0369eba8 "e1"
>? ({,,TKDraw.dll}Draw_Eval)("donly e1; axo; fit")
0x029a48f0 ""
~~~~~
For convenience it is possible to define aliases to commands in this window, for instance (here ">" is prompt provided by the command window; in the Immediate window this symbol should be entered manually):
~~~~~
>alias deval ? ({,,TKDraw}Draw_Eval)
>alias dsetshape ? ({,,TKDraw}DBRep_Set)
>alias dsetgeom ? ({,,TKDraw}DrawTrSurf_SetPnt)
>alias dsetpnt2d ? ({,,TKDraw}DrawTrSurf_SetPnt2d)
>alias saveshape ? ({,,TKBRep}BRepTools_Write)
>alias dumpshape ? ({,,TKBRep}BRepTools_Dump)
>alias dumploc ? ({,,TKBRep}BRepTools_DumpLoc)
>alias dumpgeom ? ({,,TKGeomBase}GeomTools_Dump)
~~~~~
Note that aliases are stored in the Visual Studio user's preferences and it is sufficient to define them once on a workstation. With these aliases, the above example can be reproduced easier (note the space symbol after alias name!):
~~~~~
>saveshape ("d:/edge1.brep",(void*)&anEdge1)
0x04a2f234 "d:/edge1.brep"
>dsetshape ("e1",(void*)&anEdge1)
0x0369eba8 "e1"
>deval ("donly e1; axo; fit")
0x029a48f0 ""
~~~~~
Note that there is no guarantee that the call will succeed and will not affect the program execution, thus use this feature at your own risk. In particular, the commands interacting with window system (such as *axo*, *vinit*, etc.) are known to cause application crash when the program is built in 64-bit mode. To avoid this, it is recommended to prepare all necessary view windows in advance, and arrange these windows to avoid overlapping with the Visual Studio window, to ensure that they are visible during debug.
@subsection occt_debug_vstudio_watch Customized display of variables content
Visual Studio provides a way to customize display of variables of different types in debugger windows (Watch, Autos, Locals, etc.).
In Visual Studio 2005-2010 the rules for this display are defined in file *autoexp.dat* located in subfolder *Common7\\Packages\\Debugger* of the Visual Studio installation folder (hint: the path to that folder is given in the corresponding environment variable, e.g. *VS100COMNTOOLS* for vc10). This file contains two sections: *AutoExpand* and *Visualizer*. The following rules can be added to these sections to provide more convenient display of some OCCT data types.
### \[AutoExpand\] section
~~~~~
; Open CASCADE classes
Standard_Transient=<,t> count=<count,d>
Handle_Standard_Transient=<entity,x> count=<entity->count,d> <,t>
TCollection_AsciiString=<mylength,d> <mystring,s>
TCollection_HAsciiString=<myString.mylength,d> <myString.mystring,s>
TCollection_ExtendedString=<mylength,d> <mystring,su>
TCollection_HExtendedString=<myString.mylength,d> <myString.mystring,su>
TCollection_BaseSequence=size=<Size,d> curr=<CurrentIndex,d>
TCollection_BasicMap=size=<mySize,d>
NCollection_BaseSequence=size=<mySize,d> curr=<myCurrentIndex,d>
NCollection_BaseList=length=<myLength,d>
NCollection_BaseMap=size=<mySize,d> buckets=<myNbBuckets>
NCollection_BaseVector=length=<myLength,d>
TDF_Label=<myLabelNode,x> tag=<myLabelNode->myTag>
TDF_LabelNode=tag=<myTag,d>
TDocStd_Document=format=<myStorageFormat.mystring,su> count=<count,d> <,t>
TopoDS_Shape=<myTShape.entity,x> <myOrient>
gp_XYZ=<x,g>, <y,g>, <z,g>
gp_Pnt=<coord.x,g>, <coord.y,g>, <coord.z,g>
gp_Vec=<coord.x,g>, <coord.y,g>, <coord.z,g>
gp_Dir=<coord.x,g>, <coord.y,g>, <coord.z,g>
gp_XY=<x,g>, <y,g>
gp_Pnt2d=<coord.x,g>, <coord.y,g>
gp_Dir2d=<coord.x,g>, <coord.y,g>
gp_Vec2d=<coord.x,g>, <coord.y,g>
gp_Mat2d={<matrix[0][0],g>,<matrix[0][1],g>}, {<matrix[1][0],g>,<matrix[1][1],g>}
gp_Ax1=loc={<loc.coord.x,g>, <loc.coord.y,g>, <loc.coord.z,g>} vdir={<vdir.coord.x,g>, <vdir.coord.y,g>, <vdir.coord.z,g>}
~~~~~
### \[Visualizer\] section
~~~~~
; Open CASCADE classes
NCollection_Handle<*> {
preview ( *((($T0::Ptr*)$e.entity)->myPtr) )
children ( (($T0::Ptr*)$e.entity)->myPtr )
}
NCollection_List<*> {
preview ( #( "NCollection_List [", $e.myLength, "]" ) )
children ( #list( head: $c.myFirst, next: myNext ) : #(*($T1*)(&$e+1)) )
}
NCollection_Array1<*> {
preview ( #( "NCollection_Array1 [", $e.myLowerBound, "..", $e.myUpperBound, "]" ) )
children ( #array( expr: $c.myData[$i], size: 1+$c.myUpperBound ) )
}
math_Vector {
preview ( #( "math_Vector [", $e.LowerIndex, "..", $e.UpperIndex, "]" ) )
children ( #array ( expr: ((double*)($c.Array.Addr))[$i], size: 1+$c.UpperIndex ) )
}
TColStd_Array1OfReal {
preview ( #( "Array1OfReal [", $e.myLowerBound, "..", $e.myUpperBound, "]" ) )
children ( #array ( expr: ((double*)($c.myStart))[$i], size: 1+$c.myUpperBound ) )
}
Handle_TColStd_HArray1OfReal {
preview ( #( "HArray1OfReal [",
((TColStd_HArray1OfReal*)$e.entity)->myArray.myLowerBound, "..",
((TColStd_HArray1OfReal*)$e.entity)->myArray.myUpperBound, "] ",
[$e.entity,x], " count=", $e.entity->count ) )
children ( #array ( expr: ((double*)(((TColStd_HArray1OfReal*)$e.entity)->myArray.myStart))[$i],
size: 1+((TColStd_HArray1OfReal*)$e.entity)->myArray.myUpperBound ) )
}
TColStd_Array1OfInteger {
preview ( #( "Array1OfInteger [", $e.myLowerBound, "..", $e.myUpperBound, "]" ) )
children ( #array ( expr: ((int*)($c.myStart))[$i], size: 1+$c.myUpperBound ) )
}
Handle_TColStd_HArray1OfInteger {
preview ( #( "HArray1OfInteger [",
((TColStd_HArray1OfInteger*)$e.entity)->myArray.myLowerBound, "..",
((TColStd_HArray1OfInteger*)$e.entity)->myArray.myUpperBound, "] ",
[$e.entity,x], " count=", $e.entity->count ) )
children ( #array ( expr: ((int*)(((TColStd_HArray1OfInteger*)$e.entity)->myArray.myStart))[$i],
size: 1+((TColStd_HArray1OfInteger*)$e.entity)->myArray.myUpperBound ) )
}
Handle_TCollection_HExtendedString {
preview ( #( "HExtendedString ", [$e.entity,x], " count=", $e.entity->count,
" ", ((TCollection_HExtendedString*)$e.entity)->myString ) )
children ( #([actual members]: [$e,!] ) )
}
Handle_TCollection_HAsciiString {
preview ( #( "HAsciiString ", [$e.entity,x], " count=", $e.entity->count,
" ", ((TCollection_HAsciiString*)$e.entity)->myString ) )
children ( #([actual members]: [$e,!],
#array( expr: ((TCollection_HAsciiString*)$e.entity)->myString.mystring[$i],
size: ((TCollection_HAsciiString*)$e.entity)->myString.mylength) ) )
}
~~~~~
In Visual Studio 2012 and later, visualizers can be put in a separate file in subdirectory *Visualizers*. See file *occt.natvis* for example.

View File

@@ -9,6 +9,7 @@ The following documents provide information on OCCT building, development and te
* @subpage dev_guides__contribution_workflow "Contribution Workflow"
* @subpage dev_guides__git_guide "Guide to installing and using Git for OCCT development"
* @subpage dev_guides__tests "Automatic Testing system"
* @subpage dev_guides__debug "Debugging tools and hints"
Two other documents provide details on obsolete technologies used by OCCT,
to be removed in future releases:

View File

@@ -5,133 +5,123 @@
@section OCCT_DM_SECTION_1 Introduction
This document provides practical guidenes for generation and editing of OCCT user documentation.
This document provides practical guidelines for generation and editing of OCCT user documentation.
@section OCCT_DM_SECTION_2 Prerequisites
<b>Tcl/Tk</b>
You need to have the following software installed to generate the documentation.
**Tcl/Tk**
Version 8.5 or 8.6: http://www.tcl.tk/software/tcltk/download.html
<b>Doxygen</b>
**Doxygen**
Version 1.8.4 or above: http://www.stack.nl/~dimitri/doxygen/download.html
<b>MathJax</b> (used for rendering math formulas in browser).
See \ref OCCT_DM_SECTION_A_9 paragraph for more detailed description.
The latest version: http://www.mathjax.org/download/
**MiKTeX** or other package providing **pdflatex** command (only needed for generation of PDF documents): http://miktex.org/download
<b>MiKTeX</b> or equivalent tool (used for PDF document creation)
**Inkscape** (only needed for generation of PDF documents containing SVG images): http://www.inkscape.org/download
Latest version: http://miktex.org/download
When generating PDF documentation, **pdflatex** and **inkscape** executables should be accessible by PATH variable.
You can use *custom.bat* file to add necessary paths to the *PATH* variable.
**Note**: to generate pdf documentation with MiKTeX you should execute gendoc.bat within MiKTeX environment
(run gendoc.bat in MiKTeX command promt or update PATH for MiKTeX bin folder). Also in process of pdf generation
MiKTeX can request you to download missing packages if MiKTeX was installed with option below:
Note that in the process of PDF generation MiKTeX may need some packages not installed by default.
We recommend setting option "Install missing packages on-the-fly" to "Ask me first" (default) during MiKTeX installation:
@image html /dev_guides/documentation/images/documentation_image002.png
@image latex /dev_guides/documentation/images/documentation_image002.png
@figure{/dev_guides/documentation/images/documentation_miktex.png}
If this option is set to "Yes", MiKTeX will download missing packages automatically.
On the first run of **pdflatex** it will open a dialog window prompting for installation of missing packages.
Follow the instructions to proceed (define proxy settings if needed, select a mirror site to download from, etc.).
**MathJax** is used for rendering math formulas in browser (HTML and CHM outputs): http://www.mathjax.org.
By default MathJAX scripts and fonts are taken from http://cdn.mathjax.org/mathjax/latest and no installation of MathJAX is necessary if Internet is accessible.
If you need to use OCCT documentation while off-line, you can install a local copy of MatJAX, see http://www.mathjax.org/download/.
See \ref OCCT_DM_SECTION_A_9 for more details on inserting mathematical expressions.
@section OCCT_DM_SECTION_2_1 Documentation Generation
Run gendoc.bat from OCCT directory to generate all articles are defined in FILES.txt:
Run *gendoc.bat* from OCCT directory to generate all documents defined in *FILES.txt*:
gendoc.bat options:
*gendoc.bat* can be started with the following options:
* -html : To generate HTML files (cannot be used with -pdf);
* -pdf : To generate PDF files (cannot be used with -html);
* -m=\<modules_list\> : Specifies list of articles to generate. If it is not specified, all files, mentioned in FILES.txt are processed;
* -l=\<document_name\> : Specifies the article caption for a single document;
* -h : Prints help message;
* -v : Specifies the Verbose mode (info on all script actions is shown).
* <i>-html</i> : Generates HTML files (cannot be used with -pdf);
* <i>-pdf</i> : Generates PDF files (cannot be used with -html);
* <i>-m=\<modules_list\></i> : Specifies the list of documents to generate. If it is not specified, all files mentioned in *FILES.txt* are processed;
* <i>-l=\<document_name\></i> : Specifies the output document title;
* <i>-mathjax=\<path\></i> : Specifies the path to a non-default location of MathJAX;
* <i>-h</i> : Prints a help message;
* <i>-v</i> : Toggles the Verbose mode (info on all script actions is shown).
If you run the command without arguments (like example above) it will generate HTML documentation
for all articles are defined into FILES.txt.
If you run the command without arguments (like in the example above) it will generate HTML documentation for all documents defined in *FILES.txt*.
**Note**: the generation process generates PDF files for each article,
but in html case it generates common Html page with references to the ones.
**Note**
For generation of specific article you need:
* have it's name with relative path (from \%OCCDIR\%/dox/ to the file) contained in FILES.txt
(is located into \%OCCDIR\%/dox/ directory).
* In case of a PDF output the utility generates a separate PDF file for each document;
* In case of an HTML output the utility generates a common Table of contents containing references to all documents.
@verbatim
devs_guid/documentation/documentation.md
@endverbatim
To generate the output for a specific document specify the path to the corresponding MarkDown file (paths relative to *dox* sub-folder can be given), for instance:
where documentation .md is name of article and devs_guid/documentation/ is relative path of it
~~~~
% gendoc.bat -html -m=dev_guides/documentation/documentation.md
~~~~
* use this name with -m option in the generation process:
Multiple files can be separated with commas:
~~~~
% gendoc.bat -html -m=MD_FILE_1,MD_FILE_2
~~~~
@verbatim
% gendoc.bat -html -m=devs_guid/documentation/documentation.md
@endverbatim
Use quotes to specify an article name with <i>-l</i> option, which helps to prevent incorrect interpretation of white spaces:
Multiple files are separated with comma:
@verbatim
% gendoc.bat -html -m=MD_FILE_1,MD_FILE_2
@endverbatim
To sepcify a article name with -l option, use quotes to prevent incorrect interpretation of whitespaces:
@verbatim
% gendoc.bat -pdf -m=MD_FILE_1 -l="Label of MD_FILE_1 document"
@endverbatim
~~~~
% gendoc.bat -pdf -m=MD_FILE_1 -l="Label of MD_FILE_1 document"
~~~~
@section OCCT_DM_SECTION_3 Documentation Conventions
This section contains information about conventions in the field of OCCT documentation file format,
structure of documentation directories, etc.
This section contains information about file format conventions, directories structure, etc.
@subsection OCCT_DM_SECTION_3_1 File Format
The format used for documentation is MarkDown with Doxygen extensions.
The MarkDown files have a "*.md" extension and are based on rules desribed in
\ref OCCT_DM_SECTION_A section.
The MarkDown files have a <i>*.md</i> extension and are based on rules described in \ref OCCT_DM_SECTION_A section.
@subsection OCCT_DM_SECTION_3_2 Directory Structure
@image html /dev_guides/documentation/images/documentation_image001.png
@image latex /dev_guides/documentation/images/documentation_image001.png
@figure{/dev_guides/documentation/images/documentation_folders.png}
Every separate article has own folder if images are used in it. These images
are stored into "images" subfolder.
Each document has its own folder if there are any images used in it. These images are stored in *images* subfolder.
If you want to use the same image for several documents, you can place it in *dox/resources* folder.
**Note**: To avoid incorrect image display, use a relative path to the image (starting from *dox* folder). For instance:
If you want to use the same image for several articles, you can place the one into "dox/resources" folder.
**Note**: Every article can use any image that is used by others articles. To avoid incorrect image
displaying, use relative path to the image (starting from dox folder). For instance
@verbatim
@image html /dev_guides/snv/images/snv_image001.svg
@figure{/dev_guides/documentation/images/documentation_test_image.svg}
@endverbatim
Result of generation of the documentation is:
%OCCT_DIR% / doc - a folder for generated articles;
* html/ - a directory for generated HTML pages;
* pdf/ - a directory for generated PDF files.
The documentation is generated in subfolder *doc* :
* *html* - a directory for generated HTML pages;
* *pdf* - a directory for generated PDF files.
@section OCCT_DM_SECTION_4 Adding a New Article
@section OCCT_DM_SECTION_4 Adding a New Document
- Place a new article into folder that is chosen taking into account the place of the article
at the hierarchy of the documentation. For instance the article about "using SVN working with OCCT
source code" (svn.md - the file of the article) might be placed into /dox/dev_guides/ . If the article has images then you may create
the own folder of the article and subfolder in it for images. For instance
*/dox/dev_guides/svn/ - for svn.md file
*/dox/dev_guides/svn/images/ - for images
Place a new document in the folder taking into account its logical position in the documentation hierarchy. For instance, the document *svn.md* about the use of SVN to work with OCCT source code can be placed into <i>/dox/dev_guides/</i>.
If there are images in the document, it should be placed in its own folder containing a subfolder for images. For instance:
* <i> /dox/dev_guides/svn/ </i> - for *svn.md* file;
* <i> /dox/dev_guides/svn/images/ </i> - for images.
Add a relative path to *svn.md* in file <i>dox/FILES.txt</i>. For instance
- Update dox/FILES.txt to add relative path to svn.md. For instance
@verbatim
dev_guides/snv/svn.md
dev_guides/svn/svn.md
@endverbatim
**Note**: the place of the relative path to an article is connected with the place
into treeview of html version.
**Note** that the order of paths to documents in *FILES.txt* is reproduced in the Table of Contents in the HTML output. Please, place them logically.
Note, that you should specify a file tag, not the document name.
See <a href="#OCCT_DM_SECTION_A_1">Header section</a> for details.
**Note** that you should specify a file tag, not the document name. See <a href="#OCCT_DM_SECTION_A_1">Header section</a> for details.
@section OCCT_DOC_SECTION_5 Additional Resources
@@ -145,69 +135,60 @@ http://www.stack.nl/~dimitri/doxygen/manual
@section OCCT_DM_SECTION_A Appendix 1: Document Syntax
Each OCCT document file in *.md format has a simple structure.
It can contain:
| Content type | Obligation |
| :---------------- | :-------------------: |
| Header | M |
| Footer | M |
| Plain text | O |
| List | O |
| Table | O |
| Code | O |
| Formula | O |
| Image | O |
| Page numbers | M (auto generation) |
| Table of contents | M (auto generation) |
The legend:
* M is for Mandatory
* O is for Optional
@subsection OCCT_DM_SECTION_A_1 Text Caption (a header)
headings of different levels can be specified with the following code:
A document file in *.md format must start with a proper header defining a caption and a unique tag.
@verbatim
Header 1 {#header1}
=======
Documentation System {#dev_guides__documentation}
=====================
@endverbatim
to get
The document structure is formed by sections that must be defined consistently.
Header 1
=========
The document can contain plain text, lists, tables, code snippets, images, math, etc.
Any specific text elements can be introduced by Markdown language tags or by usual HTML tags.
and with the following code:
The table of contents, page numbers (in PDF), and figure numbers (in PDF) are generated automatically.
@subsection OCCT_DM_SECTION_A_1 Headers and hierarchic document structure
Headers of different levels can be specified with the following tags:
* <i>\@section</i> - for the first-level headers;
* <i>\@subsection</i> - for the second level headers;
* <i>\@subsubsection</i> - for the third level headers.
For example:
@verbatim
Header 2 {#header2}
--------
@section occt_ocaf_1 Basic Concepts
@subsection occt_ocaf_1_1 Applications and Documents
@subsubsection occt_ocaf_1_1_1 The document and the data framework
@endverbatim
to get
Please, note that section names can be used for references within the document and in other documents, so it is necessary to use the common prefix indicative of the document name for all section names in the given document.
For example, *occt_ocaf* for sections in Open CASCADE Application Framework manual.
Header 2
---------
The remaining part of section names in most documents consists only of numbers, for example *1_1*. Actually, the hierarchical structure of the output table of contents is not based on these numbers and is generated automatically.
Where a word in curly braces is a MarkDown-style reference, which can be used in table of contents.
If you would like to have the table of contents, it is recommended to use \@section,
\@subsection and \@subsubsection pages instead of MarkDown headers as follows:
The numbers are only indicative of a section location in the body of the document. However, duplicate section names in a document inevitably cause errors during generation.
@verbatim
@section Section_Name Section Header
@subsection SubSection_Name SubSection Header
@subsubsection SubSubSection_Name SubSubSection Header
@endverbatim
If you insert a section in the middle of a big document, do not renumber the document to the end (which is inefficient and error prone), but choose an arbitrary number or letter, not yet used in the document section naming, and base the naming in this section on it.
The section hierarchy is limited to three levels and further levels cannot be presented in the Table of Contents.
However, the fourth and fifth level headers can be tagged with <i>####</i> and <i>#####</i> correspondingly.
It is also possible to use tags <i>##</i> and <i>###</i> for second and third level headers if you do not wish to show them in the table of contents or make references to them.
@subsection OCCT_DM_SECTION_A_2 Plain Text
Plain text is a text in a notepad-like format. To insert special symbols,
like \< , \> or \\, prepend them with \\ character: \\\<, \\\>, \\\\
To emphasize some words, write one pair of asterisks ( * ) or underscores ( _ ) across the word
to make it *italic* and two pairs of these symbols to make a word **Bold**.
A plain text is organized in paragraphs, separated by empty lines in MarkDown source.
The length of lines is not restricted; it is recommended to put each sentence on a separate line -- this is optimal for easier comparison of different versions of the same document.
To insert special symbols, like \< , \> or \\, prepend them with \\ character: \\\<, \\\>, \\\\, etc.
To emphasize a word or a group of words, wrap the text with one pair of asterisks (*) or underscores (_) to make it *italic* and two pairs of these symbols to make it **Bold**.
**Note** that if your emphasized text starts or ends with a special symbol, the asterisks may not work. Use explicit HTML tags \<i\>\</i\> and \<b\>\</b\> instead.
@subsection OCCT_DM_SECTION_A_3 Lists
@@ -238,7 +219,7 @@ then a space. Numbered lists can also be nested. Thus this code
1. Sub-item 1
2. Sub-item 2
2. List item 2
3. List item 3
4. List item 3
@endverbatim
produces this list:
@@ -249,6 +230,11 @@ produces this list:
2. List item 2
3. List item 3
**Note** that numbers of list items in the output are generated so they do not necessarily follow the numbering of source items.
In some cases automatic generation adversely restarts the numbering, i.e. you get list items 1. 1. 1. instead of 1. 2. 3. in the output.
The use of explicit HTML tags \<ol\>\</ol\> and \<li\>\</li\> can help in this case.
Each list item can contain several paragraphs of text; these paragraphs must
have the same indentation as text after bullet or number in the numbered list
item (otherwise numbering will be broken).
@@ -258,29 +244,7 @@ Code blocks can be inserted as paragraphs with additional indentation
and their use may cause numeration to be reset.
Example of complex nested list:
@verbatim
1. ListItem_1
Additional paragraph
code fragment
One more paragraph
1. Sub-item 1
code fragment for sub-item 1
2. Sub-item 2
Paragraph for sub-item 2
Yet one more paragraph for list item 1
2. ListItem_2
@endverbatim
Example of a complex nested list:
1. List item 1
@@ -302,8 +266,6 @@ Example of complex nested list:
2. List item 2
Note that numbers of paragraphs are regenerated so they do not necessarily
follow numbering of source items.
@subsection OCCT_DM_SECTION_A_4 Tables
@@ -340,19 +302,19 @@ which will looks as follows:
| 10 | 10 | 10 |
| 1000 | 1000 | 1000 |
Note that each table raw should be contained in one line of text; complex
tables can be created using HTML tags.
Note that each table row should be contained in one line of text; complex tables can be created using HTML tags.
@subsection OCCT_DM_SECTION_A_5 Code Blocks
It is recommended to indent a code lines with 4 spaces.
Paragraphs indented with 4 or more spaces are considered as code fragments and rendered using Courier font.
Example:
This line is indented by 4 spaces and rendered as a code block.
A fenced code block does not require indentation, and is defined by a pair of "fence lines".
Such line consists of 3 or more tilde (~) characters on a line.
The end of the block should have the same number of tildes. Here is an example:
~~~~~~~~~~~~~~~~~~~~~~~
a one-line code block
~~~~~~~~~~~~~~~~~~~~~~~
The end of the block should have the same number of tildes.
Thus it is strongly advised to use only three or four tildes.
By default the output is the same as for a normal code block.
To highlight the code, the developer has to indicate the typical file extension,
@@ -360,99 +322,84 @@ which corresponds to the programming language, after the opening fence.
For highlighting according to the C++ language, for instance, write the following code (the curly braces and dot are optional):
@verbatim
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
~~~{.cpp}
int func(int a,int b) { return a*b; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
@endverbatim
which will produce:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
~~~{.cpp}
int func(int a,int b) { return a*b; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
Verbatim content can be written by using framing \@verbatim \@endverbatim . For instance
verbatim text
Smaller code blocks can be inserted by wrapping with tags <i>\@code</i> and <i>\@endcode</i>.
Verbatim content (same as code but without syntax highlighting) can be inserted by wrapping with tags <i>\@verbatim</i> and <i>\@endverbatim</i>.
@subsection OCCT_DM_SECTION_A_6 References
To insert a reference to a website, it is proposed to write a URL. For example: http://en.wikipedia.org
To insert a reference to another part of the same document, the developer can write:
To insert a reference to a website, it is sufficient to write an URL.
For example: http://en.wikipedia.org
@verbatim
@htmlonly
<a href="#OCCT_DOC_SECTION_5">Doxygen Configuration file</a>
@endhtmlonly
@endverbatim
To insert a reference to a document or its subsection, use command <i>\@ref</i> followed by the document or section tag name.
For instance, @code @ref OCCT_DM_SECTION_A @endcode will be rendered as @ref OCCT_DM_SECTION_A.
to get a link to paragraph : @htmlonly <a href="#OCCT_DOC_SECTION_5">Doxygen configuration</a> @endhtmlonly
Note that links between documents will not work in PDF output if each document is generated independently.
Hence it is recommended to add a name of the referenced section after the tag name in the <i>\@ref</i> command (in quotes): this will guarantee that the reference is recognizable for the reader even if the cross-link is not instantiated.
For instance: @code @ref occt_modat_1 "Geometry Utilities" @endcode will be rendered as @ref occt_modat_1 "Geometry Utilities".
@subsection OCCT_DM_SECTION_A_7 Images
To insert image into document the developer can write the following code(in Doxygen-style):
For inserting images into the document use the command <i>\@figure</i>, as follows:
For HTML document:
@verbatim
@image html /relative/path/to/image/image001.png "Image caption"
@figure{/relative/path/to/image/image_file_name.png,"Image caption"}
@endverbatim
For latex document:
The first argument is a path to the image file, relative to the *dox* folder.
The supported formats for images are PNG, JPG, and SVG.
The file extension must be lowercase and correspond to the file format.
The image file name should have no dots except for the one before extension (names with more than one dot confuse **pdflatex**).
The second argument is optional, it defines the caption for the image to be inserted.
The caption argument, if given, should be quoted, even if it is a single word.
Captions are included below the image; in PDF output the images with caption are numbered automatically.
Example:
@verbatim
@image latex /relative/path/to/image/image001.png "Image caption"
@figure{/dev_guides/documentation/images/documentation_test_image.svg,"Test SVG image"}
@endverbatim
*Note*: When markdown document is used to generate html document the latex insertion is ignored (and vice versa)
due to this fact you can use image insertions in the pair, like example below:
is rendered as:
@figure{/dev_guides/documentation/images/documentation_test_image.svg,"Test SVG image"}
We recommend using **Inkscape** for creation and edition of vector graphics.
The graphics created in MS Word Draw and some other vector editors can be copy-pasted to Inkscape and saved as SVG images.
Note that the image that will be included in documentation is the whole page of the Inkscape document; use option "Resize page to content" in menu **File -> Document properties** of Inkscape to fit page dimensions to the picture (adding margins as necessary).
Note that the *figure* command is an alias to the standard Doxygen command *image* repeated twice: once for HTML and then for Latex output (used for PDF generation). Thus if HTML and PDF outputs should include different images or captions, command "image" can be used:
@verbatim
@image html /relative/path/to/image/image001.png "Image caption"
@image latex /relative/path/to/image/image001.png "Image caption"
@image html /relative/path/to/image/occ_logo.png
@image latex /relative/path/to/image/occ_logo.png "OCC logo"
@endverbatim
The code below tells Doxygen to insert a picture right in the place this code was written:
@verbatim
@image html /resources/occ_logo.png "OCCT logo"
@image latex /resources/occ_logo.png "OCCT logo"
@endverbatim
@image html /resources/occ_logo.png "OCCT logo"
@image latex /resources/occ_logo.png "OCCT logo"
@image html /resources/occ_logo.png
@image latex /resources/occ_logo.png "OCC logo"
@subsection OCCT_DM_SECTION_A_8 Table Of Contents
To get the table of contents at the beginning of the document, write \@tableofcontents tag.
But it is not needed now because TreeView option for HTML is used.
Use \@tableofcontents tag to get the table of contents at the beginning of the document.
Actually, it is not strictly necessary now because TreeView option for HTML is used.
The TOC in the PDF document will be generated automatically.
@subsection OCCT_DM_SECTION_A_9 Formulas
Formulas within documents will be generated using MathJax tool.
A developer has to specify these parameters in Doxyfile to enable support of MathJax in Doxygen:
USE_MATHJAX = YES
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
To use MathJax tool with the HTML page, it's \<head\> block has to contain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.html}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
displayAlign: "left"
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First script configures MathJax to understand separator types and to left allign formulas.
The second script inserts reference to MathJax tool.
This tool will always be used when the HTML output will be shown.
Formulas within MarkDown documents can be defined using LaTeX syntax.
Equations can be written by several ways:
@@ -485,8 +432,10 @@ gives the following result:
\right|
@f$
2.Formulas can also be put between @verbatim \begin{align} @endverbatim and @verbatim \end{align} @endverbatim tags. An example:
2.Formulas can also be put between @verbatim \begin{align} @endverbatim and @verbatim \end{align} @endverbatim tags.
For example:
@verbatim
\begin{align}
\dot{x} & = \sigma(y-x) \\

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="443.5307"
height="187.48862"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="test_image.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="295.90235"
inkscape:cy="-323.77532"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1366"
inkscape:window-height="716"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:snap-page="false"
borderlayer="false"
fit-margin-top="5"
fit-margin-left="5"
fit-margin-right="5"
fit-margin-bottom="5" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-79.097656,-21.098232)">
<path
sodipodi:type="spiral"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path2985"
sodipodi:cx="142.85715"
sodipodi:cy="126.6479"
sodipodi:expansion="1"
sodipodi:revolution="3"
sodipodi:radius="73.178566"
sodipodi:argument="-18.174814"
sodipodi:t0="0"
d="m 142.85715,126.6479 c 2.86505,2.29205 -1.67612,4.99285 -3.80953,4.76191 -5.78142,-0.62584 -7.49143,-7.75205 -5.71428,-12.38096 3.17892,-8.28004 13.59119,-10.36558 20.95239,-6.66665 10.80286,5.42832 13.31404,19.50561 7.61903,29.52381 -7.59056,13.35269 -25.44626,16.29352 -38.09525,8.5714 -15.91746,-9.71749 -19.28891,-31.39926 -9.52378,-46.66667 11.82689,-18.490884 37.35922,-22.29349 55.23811,-10.476151 21.06966,13.926321 25.30383,43.323481 11.42852,63.809531 -16.01959,23.65196 -49.29063,28.31803 -72.38096,12.3809 C 82.334702,151.39625 77.236493,114.2452 95.238126,88.552628 115.43324,59.729444 156.46861,54.198885 184.76195,74.26698 c 31.41097,22.27939 37.37404,67.20227 15.23802,98.09525" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="225.71429"
y="55.219326"
id="text2987"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2989"
x="225.71429"
y="55.219326">Test SVG image</tspan></text>
<path
style="fill:#d40000"
id="path2996"
d="m 225.93253,80.077991 c 3.24312,6.556366 8.29882,11.800272 13.5792,16.763957 4.5107,4.980932 7.56994,10.929012 10.6621,16.828992 2.61039,5.79272 3.86714,11.94331 7.08009,17.44901 3.75425,6.35398 6.70021,13.19689 8.79217,20.27197 4.84784,15.88966 11.74851,2.45314 -37.25143,18.61001 -0.78487,0.2588 0.15562,-1.64589 0.20424,-2.47091 0.0536,-0.90872 0.0682,-1.81932 0.10224,-2.72899 0.17911,-6.50471 -0.15488,-13.01656 0.28271,-19.50992 0.46019,-6.30504 2.24023,-12.34988 4.0286,-18.37582 2.36519,-5.44796 6.30711,-10.00347 9.73908,-14.79837 3.98599,-5.97976 8.02146,-11.96839 13.10341,-17.072556 4.37574,-4.432922 8.35123,-9.243914 12.37764,-13.99199 4.43478,-4.829914 10.15101,-8.139537 15.06208,-12.425011 14.95925,-12.429871 35.2123,-18.385688 51.95332,-26.62658 11.5059,-5.663868 -23.27039,10.786567 -34.90558,16.179851 17.6228,-9.547136 35.52389,-19.290175 55.17352,-23.555822 4.29932,-0.713125 2.15416,-0.406331 6.43505,-0.923403 0,0 -35.68459,22.595324 -35.68459,22.595324 l 0,0 c -4.12774,0.727408 -2.06126,0.312559 -6.19873,1.248113 -3.11612,0.864072 -6.22731,1.766121 -9.25625,2.908329 -0.8427,0.317783 -3.30812,1.424428 -2.49421,1.03881 40.69568,-19.281166 46.47137,-22.237336 32.54467,-15.189227 -79.1837,37.555094 -31.13152,14.703661 -6.06008,3.03043 4.62777,-2.154687 -15.27783,7.276298 -11.28272,6.532336 -1.75524,1.522667 -3.27126,3.31763 -5.09432,4.758404 -3.18452,2.516733 -7.13492,4.190007 -9.93487,7.239896 -4.62518,4.303389 -8.28044,9.606276 -12.50569,14.296007 -0.80437,0.69437 -4.493,3.820284 -5.21444,4.670532 -2.98505,3.518007 -5.33483,7.691189 -8.08882,11.393589 -2.92337,4.905278 -6.62131,9.277358 -10.15131,13.755678 -2.01215,5.68475 -3.56944,11.57461 -4.40544,17.54154 -0.83081,6.35553 -0.13439,12.77693 -0.29528,19.17264 -0.0102,1.50844 -0.0276,5.46288 -0.0732,5.48876 -34.08891,19.36365 -36.17581,33.13461 -40.63381,14.4297 -1.84609,-6.79718 -4.68694,-13.28977 -8.31428,-19.32972 -3.24304,-5.58446 -4.82126,-11.64528 -7.31615,-17.57296 -2.8174,-5.54315 -5.55105,-11.15816 -9.9264,-15.68612 -5.41001,-5.49645 -10.6705,-11.1173 -14.41843,-17.919019 0,0 38.38591,-18.02746 38.38591,-18.02746 z"
inkscape:connector-curvature="0"
transform="translate(84.097656,26.098232)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -20,7 +20,7 @@ proc OverviewDoc_DetectCasVersion {theCasRoot} {
}
# Generates Doxygen configuration file for Overview documentation
proc OverviewDoc_MakeDoxyfile {casDir outDir tagFileDir {doxyFileName} {generatorMode ""} DocFilesList verboseMode searchMode hhcPath} {
proc OverviewDoc_MakeDoxyfile {casDir outDir tagFileDir {doxyFileName} {generatorMode ""} DocFilesList verboseMode searchMode hhcPath mathjaxLocation} {
set doxyFile [open $doxyFileName "w"]
set casroot $casDir
@@ -83,6 +83,10 @@ proc OverviewDoc_MakeDoxyfile {casDir outDir tagFileDir {doxyFileName} {generato
# Keep doxygen comments within code blocks
puts $doxyFile "STRIP_CODE_COMMENTS = NO"
# Define alias for inserting images to both HRML and PDF at once
puts $doxyFile "ALIASES += figure\{1\}=\"\\image html \\1 \\n \\image latex \\1\""
puts $doxyFile "ALIASES += figure\{2\}=\"\\image html \\1 \\2 \\n \\image latex \\1 \\2\""
set PARAM_INPUT "INPUT ="
set PARAM_IMAGEPATH "IMAGE_PATH = $inputDir/resources/ "
@@ -150,7 +154,7 @@ proc OverviewDoc_MakeDoxyfile {casDir outDir tagFileDir {doxyFileName} {generato
puts $doxyFile "FORMULA_TRANSPARENT = YES"
puts $doxyFile "USE_MATHJAX = YES"
puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
puts $doxyFile "MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest"
puts $doxyFile "MATHJAX_RELPATH = ${mathjaxLocation}"
} elseif { $generatorMode == "CHM_ONLY"} {
puts $doxyFile "GENERATE_HTMLHELP = YES"
@@ -162,7 +166,7 @@ proc OverviewDoc_MakeDoxyfile {casDir outDir tagFileDir {doxyFileName} {generato
puts $doxyFile "FORMULA_TRANSPARENT = YES"
puts $doxyFile "USE_MATHJAX = YES"
puts $doxyFile "MATHJAX_FORMAT = HTML-CSS"
puts $doxyFile "MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest"
puts $doxyFile "MATHJAX_RELPATH = ${mathjaxLocation}"
} elseif { $generatorMode == "PDF_ONLY"} {
puts $doxyFile "GENERATE_HTMLHELP = NO"
@@ -215,25 +219,26 @@ proc OverviewDoc_PrintHelpMessage {} {
puts "\nUsage : occdoc \[-h\] \[-html\] \[-pdf\] \[-m=<list of files>\] \[-l=<document name>\] \[-v\] \[-s\]"
puts ""
puts " Options are : "
puts " -html : To generate HTML files"
puts " (cannot be used with -pdf or -chm)"
puts " -pdf : To generate PDF files"
puts " (cannot be used with -html or chm)"
puts " -chm : To generate CHM files"
puts " (cannot be used with -html or pdf)"
puts " -hhc : To define path to hhc - chm generator"
puts " : is used with just -chm option"
puts " -m=<modules_list> : Specifies list of documents to generate."
puts " If it is not specified, all files, "
puts " mentioned in FILES.txt are processed."
puts " -l=<document_name> : Specifies the document caption "
puts " for a single document"
puts " -h : Prints help message"
puts " -v : Specifies the Verbose mode"
puts " (info on all script actions is shown)"
puts " -s=<search_mode> : Specifies the Search mode of HTML documents."
puts " Can be: none | local | server | external | "
puts " : Can be used only with -html option"
puts " -html : To generate HTML files"
puts " (cannot be used with -pdf or -chm)"
puts " -pdf : To generate PDF files"
puts " (cannot be used with -html or chm)"
puts " -chm : To generate CHM files"
puts " (cannot be used with -html or pdf)"
puts " -hhc : To define path to hhc - chm generator"
puts " : is used with just -chm option"
puts " -m=<modules_list> : Specifies list of documents to generate."
puts " If it is not specified, all files "
puts " mentioned in FILES.txt are processed."
puts " -l=<document_name> : Specifies the document caption "
puts " for a single document"
puts " -h : Prints help message"
puts " -v : Specifies the Verbose mode"
puts " (info on all script actions is shown)"
puts " -s=<search_mode> : Specifies the Search mode of HTML documents."
puts " Can be: none | local | server | external"
puts " : Can be used only with -html option"
puts " -mathjax=<path> : To use local or alternative copy of MathJax"
}
# Parses command line arguments
@@ -310,6 +315,9 @@ proc OverviewDoc_MakeRefmanTex {fileName latexDir docLabel verboseMode} {
if {[file exists $DOCNAME] == 1} {
file delete -force $DOCNAME
}
set year [clock format [clock seconds] -format {%Y}]
set texfile [open $DOCNAME w]
puts $texfile "\\batchmode"
@@ -384,8 +392,8 @@ proc OverviewDoc_MakeRefmanTex {fileName latexDir docLabel verboseMode} {
puts $texfile "\\fancyhead\[RO\]{\\fancyplain{}{\\bfseries\\thepage}}"
puts $texfile "\\fancyfoot\[LE\]{\\fancyplain{}{}}"
puts $texfile "\\fancyfoot\[CE\]{\\fancyplain{}{}}"
puts $texfile "\\fancyfoot\[RE\]{\\fancyplain{}{\\bfseries\\scriptsize (c) Open CASCADE 2001\-2013}}"
puts $texfile "\\fancyfoot\[LO\]{\\fancyplain{}{\\bfseries\\scriptsize (c) Open CASCADE 2001\-2013}}"
puts $texfile "\\fancyfoot\[RE\]{\\fancyplain{}{\\bfseries\\scriptsize Copyright (c) Open CASCADE $year}}"
puts $texfile "\\fancyfoot\[LO\]{\\fancyplain{}{\\bfseries\\scriptsize Copyright (c) Open CASCADE $year}}"
puts $texfile "\\fancyfoot\[CO\]{\\fancyplain{}{}}"
puts $texfile "\\fancyfoot\[RO\]{\\fancyplain{}{}}"
puts $texfile "\\renewcommand{\\footrulewidth}{0.4pt}"
@@ -483,6 +491,8 @@ proc OverviewDoc_ProcessTex {{texFiles {}} {latexDir} verboseMode} {
while {1} {
set line [gets $IN_F]
if { [string first "\\includegraphics" $line] != -1 } {
# replace svg extension by pdf
set line [regsub {[.]svg} $line ".pdf"]
# Center images in TeX files
set line "\\begin{center}\n $line\n\\end{center}"
} elseif { [string first "\\subsection" $line] != -1 } {
@@ -508,8 +518,27 @@ proc OverviewDoc_ProcessTex {{texFiles {}} {latexDir} verboseMode} {
}
}
# Convert SVG files to PDF format to allow including them to PDF
# (requires InkScape to be in PATH)
proc OverviewDoc_ProcessSvg {latexDir verboseMode} {
foreach file [glob -nocomplain $latexDir/*.svg] {
if {$verboseMode == "YES"} {
puts "INFO: Converting file $file"
}
set pdffile "[file rootname $file].pdf"
if { [catch {exec inkscape -z -D --file=$file --export-pdf=$pdffile} res] } {
puts "Error: $res"
puts "Conversion failed; check that Inkscape is in PATH!"
puts "SVG images will be lost in PDF documents"
return
}
}
}
# Main procedure for documents compilation
proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchMode hhcPath} {
proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchMode hhcPath mathjaxLocation} {
set INDIR [file normalize [file dirname [info script]]]
set CASROOT [file normalize [file dirname "$INDIR/../../"]]
@@ -536,23 +565,36 @@ proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchM
file delete -force $LATEXDIR
}
file mkdir $LATEXDIR
# is MathJax HLink?
set mathjax_relative_location $mathjaxLocation
if { [file isdirectory "$mathjaxLocation"] == 1 } {
if { $generatorMode == "HTML_ONLY"} {
# related path
set mathjax_relative_location [relativePath $HTMLDIR $mathjaxLocation]
} elseif { $generatorMode == "CHM_ONLY"} {
# absolute path
set mathjax_relative_location [file normalize $mathjaxLocation]
}
}
# Run tools to compile documents
puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating Doxyfile..."
OverviewDoc_MakeDoxyfile $CASROOT "$OUTDIR/overview" $TAGFILEDIR $DOXYFILE $generatorMode $docfiles $verboseMode $searchMode $hhcPath
OverviewDoc_MakeDoxyfile $CASROOT "$OUTDIR/overview" $TAGFILEDIR $DOXYFILE $generatorMode $docfiles $verboseMode $searchMode $hhcPath $mathjax_relative_location
# Run doxygen tool
set starttimestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M}]
if { $generatorMode == "HTML_ONLY"} {
puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating HTML files..."
puts "$starttimestamp Generating HTML files..."
} elseif { $generatorMode == "CHM_ONLY" } {
puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generating CHM file..."
puts "$starttimestamp Generating CHM file..."
}
set RESULT [catch {exec doxygen $DOXYFILE > $OUTDIR/doxygen_out.log} DOX_ERROR]
if {$RESULT != 0} {
if {[llength [split $DOX_ERROR "\n"]] > 1} {
if {$verboseMode == "YES"} {
puts "See Doxygen log in $OUTDIR/doxygen_warnings_and_errors.log"
puts "Error running Doxygen; see log in\n$OUTDIR/doxygen_warnings_and_errors.log"
}
set DOX_ERROR_FILE [open "$OUTDIR/doxygen_warnings_and_errors.log" "w"]
puts $DOX_ERROR_FILE $DOX_ERROR
@@ -594,6 +636,11 @@ proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchM
}
OverviewDoc_ProcessTex $TEXFILES $LATEXDIR $verboseMode
if {$verboseMode == "YES"} {
puts "Converting SVG images to PNG format..."
}
OverviewDoc_ProcessSvg $LATEXDIR $verboseMode
if {$verboseMode == "YES"} {
puts "Generating PDF files from TeX files..."
}
@@ -611,7 +658,7 @@ proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchM
if {$RESULT != 0} {
if {[llength [split $LaTeX_ERROR "\n"]] > 1} {
if {$verboseMode == "YES"} {
puts "See Latex log in $OUTDIR/pdflatex_warnings_and_errors.log"
puts "Errors running Latex; see log in \n$OUTDIR/pdflatex_warnings_and_errors.log"
}
set LaTeX_ERROR_FILE [open "$OUTDIR/pdflatex_warnings_and_errors.log" "w"]
puts $LaTeX_ERROR_FILE $LaTeX_ERROR
@@ -627,7 +674,7 @@ proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchM
}
if {![file exists "$LATEXDIR/refman.pdf"]} {
puts "Error: file $LATEXDIR/refman.pdf does not exist"
puts "Error: Latex failed to create $LATEXDIR/refman.pdf"
return
}
@@ -638,16 +685,47 @@ proc OverviewDoc_Main { {docfiles {}} generatorMode docLabel verboseMode searchM
cd $INDIR
puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed"
if { $generatorMode == "HTML_ONLY" } {
puts "View generated HTML documentation by opening: "
set RESFILE $OUTDIR/overview/html/index.html
puts "$RESFILE"
puts "View generated HTML documentation by opening:"
puts "$OUTDIR/overview/html/index.html"
}
if { $generatorMode == "PDF_ONLY" } {
puts "PDF files are generated in: "
puts "$OUTDIR/overview/pdf folder"
puts "PDF files are generated in folder:"
puts "$OUTDIR/overview/pdf"
}
}
proc relativePath {thePathFrom thePathTo} {
if { [file isdirectory "$thePathFrom"] == 0 } {
return ""
}
set aPathFrom [file normalize "$thePathFrom"]
set aPathTo [file normalize "$thePathTo"]
set aCutedPathFrom "${aPathFrom}/dummy"
set aRelatedDeepPath ""
while { "$aCutedPathFrom" != [file normalize "$aCutedPathFrom/.."] } {
set aCutedPathFrom [file normalize "$aCutedPathFrom/.."]
# does aPathTo contain aCutedPathFrom?
regsub -all $aCutedPathFrom $aPathTo "" aPathFromAfterCut
if { "$aPathFromAfterCut" != "$aPathTo" } { # if so
if { "$aCutedPathFrom" == "$aPathFrom" } { # just go higher, for example, ./somefolder/someotherfolder
set aPathTo ".${aPathTo}"
} elseif { "$aCutedPathFrom" == "$aPathTo" } { # remove the last "/"
set aRelatedDeepPath [string replace $aRelatedDeepPath end end ""]
}
regsub -all $aCutedPathFrom $aPathTo $aRelatedDeepPath aPathToAfterCut
regsub -all "//" $aPathToAfterCut "/" aPathToAfterCut
return $aPathToAfterCut
}
set aRelatedDeepPath "$aRelatedDeepPath../"
}
return $thePathTo
}
# A command for User Documentation compilation
proc occdoc {args} {
# Programm options
@@ -659,6 +737,9 @@ proc occdoc {args} {
set SEARCH_MODE "none"
set hhcPath ""
set mathjax_location "http://cdn.mathjax.org/mathjax/latest"
set mathjax_js_name "MathJax.js"
global available_docfiles
global tcl_platform
global args_names
@@ -758,6 +839,19 @@ proc occdoc {args} {
puts "Error in argument s"
return
}
} elseif {$arg_n == "mathjax"} {
if {![info exists args_values(pdf)]} {
set possible_mathjax_loc $args_values(mathjax)
if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} {
set mathjax_location $args_values(mathjax)
puts "$mathjax_location"
} else {
puts "Warning: $mathjax_js_name isn't found in $possible_mathjax_loc."
puts " MathJax will be used from $mathjax_location"
}
} else {
puts "Info: MathJax is not used with pdf and will be ignored"
}
} else {
puts "\nWrong argument: $arg_n"
OverviewDoc_PrintHelpMessage
@@ -777,5 +871,5 @@ proc occdoc {args} {
}
# Start main activities
OverviewDoc_Main $DOCFILES $GEN_MODE $DOCLABEL $VERB_MODE $SEARCH_MODE $hhcPath
OverviewDoc_Main $DOCFILES $GEN_MODE $DOCLABEL $VERB_MODE $SEARCH_MODE $hhcPath $mathjax_location
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -0,0 +1,512 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="ocaf.svg">
<defs
id="defs4">
<clipPath
id="clipEmfPath1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3001"
height="22.583204"
width="33.706238"
y="12.49604"
x="23.173038" />
</clipPath>
<clipPath
id="clipEmfPath2"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3004"
height="22.583204"
width="33.856712"
y="193.16167"
x="176.50632" />
</clipPath>
<clipPath
id="clipEmfPath3"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3007"
height="22.583204"
width="33.706238"
y="12.49604"
x="316.59788" />
</clipPath>
<clipPath
id="clipEmfPath4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3010"
height="22.583204"
width="33.856712"
y="193.16167"
x="469.93116" />
</clipPath>
<clipPath
id="clipEmfPath5"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3013"
height="22.583204"
width="33.856712"
y="97.258332"
x="382.35513" />
</clipPath>
<clipPath
id="clipEmfPath1-1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3132"
height="44.154422"
width="125.37695"
y="131.71234"
x="271.49972" />
</clipPath>
<clipPath
id="clipEmfPath2-7"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3135"
height="44.154422"
width="125.37695"
y="212.8123"
x="271.49972" />
</clipPath>
<clipPath
id="clipEmfPath3-4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3138"
height="44.154422"
width="107.3371"
y="212.8123"
x="433.85835" />
</clipPath>
<clipPath
id="clipEmfPath4-0"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3141"
height="17.121102"
width="549.31338"
y="293.91226"
x="0.90199242" />
</clipPath>
<clipPath
id="clipEmfPath5-9"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3144"
height="18.022213"
width="333.7372"
y="338.51723"
x="72.61039" />
</clipPath>
<clipPath
id="clipEmfPath6"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3147"
height="18.022213"
width="342.75712"
y="374.56166"
x="72.61039" />
</clipPath>
<clipPath
id="clipEmfPath7"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3150"
height="18.022213"
width="243.53795"
y="410.60608"
x="135.74986" />
</clipPath>
<clipPath
id="clipEmfPath1-4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3337"
height="188.43307"
width="602.36218"
y="0"
x="0" />
</clipPath>
<clipPath
id="clipEmfPath2-8"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3340"
height="168.77963"
width="461.37103"
y="13.50237"
x="1.4999058" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="375"
inkscape:cy="845.71429"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1065"
inkscape:window-height="932"
inkscape:window-x="113"
inkscape:window-y="14"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2989" />
<g
id="g3120" />
<g
id="g3342"
transform="translate(13.4445,5.5890899)">
<text
id="text3344"
style="font-size:12.44921875px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
y="188.43307"
x="464.07086"
xml:space="preserve"> </text>
<path
id="path3346"
d="m 0.93744115,8.4389813 0,178.7188687 462.40221885,0 0,-178.7188687 -462.40221885,0 z"
clip-path="url(#clipEmfPath1-4)"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
inkscape:connector-curvature="0" />
<path
id="path3348"
d="m 0.93744115,8.4389813 0,178.7188687 462.40221885,0 0,-178.7188687 z"
style="fill:none;stroke:#000000;stroke-width:0.93744117px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<text
id="text3350"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Wingdings 2"
y="49.958771"
x="10.499341"
xml:space="preserve"></text>
<text
id="text3352"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="36.156345"
x="17.248917"
xml:space="preserve">(</text>
<text
id="text3354"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="36.156345"
x="20.54871"
xml:space="preserve">-</text>
<text
id="text3356"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="36.156345"
x="23.848503"
xml:space="preserve">myWidth / 2., 0 , 0)</text>
<text
id="text3358"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="39.907005"
x="107.84323"
xml:space="preserve"> </text>
<text
id="text3360"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="39.907005"
x="124.49218"
xml:space="preserve"> </text>
<text
id="text3362"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="39.907005"
x="128.54193"
xml:space="preserve"> </text>
<text
id="text3364"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="39.907005"
x="143.24101"
xml:space="preserve"> </text>
<text
id="text3366"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="39.907005"
x="187.48824"
xml:space="preserve"> </text>
<text
id="text3368"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="39.907005"
x="231.73544"
xml:space="preserve"> </text>
<text
id="text3370"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Wingdings 2"
y="49.958771"
x="275.98267"
xml:space="preserve"></text>
<text
id="text3372"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="282.73224"
xml:space="preserve">(myWidth / </text>
<text
id="text3374"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="333.42908"
xml:space="preserve">2</text>
<text
id="text3376"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="338.82874"
xml:space="preserve">., </text>
<text
id="text3378"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="347.22821"
xml:space="preserve">0</text>
<text
id="text3380"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="352.77786"
xml:space="preserve"> </text>
<text
id="text3382"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="355.47769"
xml:space="preserve">, </text>
<text
id="text3384"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="361.17731"
xml:space="preserve">0</text>
<text
id="text3386"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="366.72699"
xml:space="preserve">)</text>
<text
id="text3388"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="61.210743"
x="369.87677"
xml:space="preserve"> </text>
<text
id="text3390"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Wingdings 2"
y="103.6682"
x="10.499341"
xml:space="preserve"></text>
<text
id="text3392"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="17.248917"
xml:space="preserve">(</text>
<text
id="text3394"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="20.54871"
xml:space="preserve">-</text>
<text
id="text3396"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="23.848503"
xml:space="preserve">myWidth / 2., </text>
<text
id="text3398"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="85.044662"
xml:space="preserve">-</text>
<text
id="text3400"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="88.344452"
xml:space="preserve">myThickness / 4.</text>
<text
id="text3402"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="163.33975"
xml:space="preserve"> </text>
<text
id="text3404"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="89.865776"
x="166.18958"
xml:space="preserve">, 0)</text>
<text
id="text3406"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="93.616432"
x="180.58865"
xml:space="preserve"> </text>
<text
id="text3408"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="93.616432"
x="187.48824"
xml:space="preserve"> </text>
<text
id="text3410"
style="font-size:14.99905872px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="93.616432"
x="231.73544"
xml:space="preserve"> </text>
<text
id="text3412"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Wingdings 2"
y="103.6682"
x="275.98267"
xml:space="preserve"></text>
<text
id="text3414"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="114.92017"
x="282.73224"
xml:space="preserve">(myWidth / 2., </text>
<text
id="text3416"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="114.92017"
x="347.22821"
xml:space="preserve">myThickne</text>
<text
id="text3418"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="114.92017"
x="395.52518"
xml:space="preserve">ss / 4.</text>
<text
id="text3420"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="114.92017"
x="422.22348"
xml:space="preserve"> </text>
<text
id="text3422"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="114.92017"
x="424.92331"
xml:space="preserve">, 0)</text>
<text
id="text3424"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="114.92017"
x="439.32242"
xml:space="preserve"> </text>
<text
id="text3426"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Wingdings 2"
y="137.27409"
x="145.49088"
xml:space="preserve"></text>
<text
id="text3428"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="137.27409"
x="152.24043"
xml:space="preserve"> </text>
<text
id="text3430"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="148.52608"
x="156.44019"
xml:space="preserve">(0 , </text>
<text
id="text3432"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="148.52608"
x="173.6891"
xml:space="preserve">-</text>
<text
id="text3434"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="148.52608"
x="176.98889"
xml:space="preserve">myThickness / 2. , 0)</text>
<text
id="text3436"
style="font-size:7.49952936px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="137.27409"
x="269.0831"
xml:space="preserve"> </text>
<text
id="text3438"
style="font-size:10.04936886px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial Unicode MS"
y="174.63065"
x="100.49369"
xml:space="preserve"> </text>
</g>
<g
id="g3501"
transform="translate(16.56497,18.45006)">
<text
id="text3503"
style="font-size:13.83647633px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
y="11.821392"
x="-0.15039648"
xml:space="preserve"> </text>
<path
id="path3505"
d="m 144.22083,160.60232 0,-153.7065083 c 0,-0.3410016 0.28199,-0.6251697 0.62978,-0.6251697 0.34779,0 0.62039,0.2841681 0.62039,0.6251697 l 0,153.7065083 c 0,0.35047 -0.2726,0.63464 -0.62039,0.63464 -0.34779,0 -0.62978,-0.28417 -0.62978,-0.63464 z M 141.0907,8.1650958 l 3.75991,-7.57781513 3.75991,7.57781513 z"
clip-path="url(#clipEmfPath0)"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15039648px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
id="path3507"
d="m 0.52638768,36.581902 418.17741232,0 c 0.33839,0 0.62039,0.284168 0.62039,0.62517 0,0.359946 -0.282,0.644114 -0.62039,0.644114 l -418.17741232,0 c -0.33839208,0 -0.62038548,-0.284168 -0.62038548,-0.644114 0,-0.341002 0.2819934,-0.62517 0.62038548,-0.62517 z M 417.44423,33.418165 l 7.51983,3.788907 -7.51983,3.788908 z"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15039648px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -52,8 +52,7 @@ This modeling requires four steps:
To create the bottle's profile, you first create characteristic points with their coordinates as shown below in the (XOY) plane. These points will be the supports that define the geometry of the profile.
@image html /tutorial/images/tutorial_image003.png
@image latex /tutorial/images/tutorial_image003.png
@figure{/tutorial/images/tutorial_image003.svg}
There are two classes to describe a 3D Cartesian point from its X, Y and Z coordinates in Open CASCADE Technology:
@@ -67,7 +66,7 @@ To choose the best class for this application, consider the following:
* *Geom_CartesianPoint* is manipulated by handle and may have multiple references and a long lifetime.
Since all the points you will define are only used to create the profile's curves, an object with a limited lifetime will do. Choose the *gp_Pnt* class.
To instantiate a *gp_Pnt* object, just specify the X, Y, and Z coordinates of the points in the global cartesian coordinate system:
To instantiate a *gp_Pnt* object, just specify the X, Y, and Z coordinates of the points in the global Cartesian coordinate system:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
gp_Pnt aPnt1(-myWidth / 2., 0, 0);

View File

@@ -1252,7 +1252,7 @@ clear
foreach var [directory c_*] {erase $var}
# clear 2d views
2d clear
2dclear
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsubsection occt_draw_4_1_15 repaint, dflush
@@ -2258,7 +2258,7 @@ Syntax:
meshshadcolor meshname red green blue
~~~~~
Changes the face interior color of object **meshname**. The *red*, *green** and *blue* are real values between *0* and *1*.
Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
**Example:**
~~~~~
@@ -3993,7 +3993,7 @@ parabola p2 0 0 0 1 50
parabola p3 0 0 0 1 0 0 0 0 1 50
~~~~~
@subsubsection occt_draw_6_2_7 beziercurve, dbeziercurve
@subsubsection occt_draw_6_2_7 beziercurve, 2dbeziercurve
Syntax:
~~~~~
@@ -4012,13 +4012,15 @@ Creates a 3d rational or non-rational Bezier curve. Give the number of poles (co
beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10
~~~~~
@subsubsection occt_draw_6_2_8 bsplinecurve, dbsplinecurve, pbsplinecurve, dpbsplinecurve
@subsubsection occt_draw_6_2_8 bsplinecurve, 2dbsplinecurve, pbsplinecurve, 2dpbsplinecurve
Syntax:
~~~~~
bsplinecurve name degree nbknots knot, umult pole, weight 2dbsplinecurve name degree nbknots knot, umult pole, weight pbsplinecurve name degree nbknots knot, umult pole, weight(periodic)
bsplinecurve name degree nbknots knot, umult pole, weight
2dbsplinecurve name degree nbknots knot, umult pole, weight
2dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
pbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
2dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
~~~~~
Creates 2d or 3d bspline curves; the **pbsplinecurve** and **2dpbsplinecurve** commands create periodic bspline curves.
@@ -4076,7 +4078,7 @@ viso c2 c
**Note** that this cannot be done from offset surfaces.
@subsubsection occt_draw_6_2_10 tod, tod
@subsubsection occt_draw_6_2_10 to3d, to2d
Syntax:
~~~~~

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -0,0 +1,504 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="549.58691"
height="442.80087"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="ocaf3.svg">
<defs
id="defs4">
<clipPath
id="clipEmfPath1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3001"
height="22.583204"
width="33.706238"
y="12.49604"
x="23.173038" />
</clipPath>
<clipPath
id="clipEmfPath2"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3004"
height="22.583204"
width="33.856712"
y="193.16167"
x="176.50632" />
</clipPath>
<clipPath
id="clipEmfPath3"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3007"
height="22.583204"
width="33.706238"
y="12.49604"
x="316.59787" />
</clipPath>
<clipPath
id="clipEmfPath4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3010"
height="22.583204"
width="33.856712"
y="193.16167"
x="469.93115" />
</clipPath>
<clipPath
id="clipEmfPath5"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3013"
height="22.583204"
width="33.856712"
y="97.258331"
x="382.35513" />
</clipPath>
<clipPath
id="clipEmfPath1-1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3132"
height="44.154423"
width="125.37695"
y="131.71234"
x="271.49973" />
</clipPath>
<clipPath
id="clipEmfPath2-7"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3135"
height="44.154423"
width="125.37695"
y="212.8123"
x="271.49973" />
</clipPath>
<clipPath
id="clipEmfPath3-4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3138"
height="44.154423"
width="107.3371"
y="212.8123"
x="433.85834" />
</clipPath>
<clipPath
id="clipEmfPath4-0"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3141"
height="17.121101"
width="549.31335"
y="293.91226"
x="0.90199244" />
</clipPath>
<clipPath
id="clipEmfPath5-9"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3144"
height="18.022213"
width="333.73721"
y="338.51724"
x="72.61039" />
</clipPath>
<clipPath
id="clipEmfPath6"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3147"
height="18.022213"
width="342.75711"
y="374.56165"
x="72.61039" />
</clipPath>
<clipPath
id="clipEmfPath7"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3150"
height="18.022213"
width="243.53795"
y="410.60608"
x="135.74986" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.70698094"
inkscape:cx="287.00859"
inkscape:cy="22.17673"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1065"
inkscape:window-height="932"
inkscape:window-x="22"
inkscape:window-y="22"
inkscape:window-maximized="0"
inkscape:snap-page="false"
inkscape:snap-bbox="true"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-global="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-63.736307,-64.65625)">
<g
id="g2989" />
<g
id="g3120" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath1-1)"
d="m 270.99235,207.81864 0,54.06664 126.27894,0 0,-54.06664 -126.27894,0 z"
id="path3166"
transform="matrix(1.0333295,0,0,1.0465218,64.357675,64.546499)" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath2-7)"
d="m 433.35098,207.81864 0,54.06664 108.23909,0 0,-54.06664 -108.23909,0 z"
id="path3178"
transform="matrix(1.0333295,0,0,1.0465218,64.357675,64.546499)" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath3-4)"
d="m 0.39462168,288.9186 0,27.03332 550.21537832,0 0,-27.03332 -550.21537832,0 z"
id="path3188"
transform="matrix(1.0333295,0,0,1.0465218,64.357675,64.546499)" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15033206px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
clip-path="url(#clipEmfPath4-0)"
d="m 325.73201,63.640939 0,56.826291 c 0,0.35669 -0.26308,0.61951 -0.62012,0.61951 -0.33824,0 -0.62012,-0.26282 -0.62012,-0.61951 l 0,-56.826291 c 0,-0.337916 0.28188,-0.619513 0.62012,-0.619513 0.35704,0 0.62012,0.281597 0.62012,0.619513 z m 3.13818,55.568491 -3.7583,7.50925 -3.7583,-7.50925 z"
id="path3198"
transform="matrix(1.0333295,0,0,1.0465218,64.357675,64.546499)" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath5-9)"
d="m 18.43447,370.01856 0,18.02221 45.099621,0 0,-18.02221 -45.099621,0 z"
id="path3240"
transform="matrix(1.0333295,0,0,1.0465218,64.357675,64.546499)" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath6)"
d="m 135.69348,406.06298 0,27.03332 243.53796,0 0,-27.03332 -243.53796,0 z"
id="path3254"
transform="matrix(1.0333295,0,0,1.0465218,64.357675,64.546499)" />
<text
xml:space="preserve"
x="215.31396"
y="504.24854"
style="font-size:14.38245487px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3256"
transform="scale(0.99367708,1.0063631)" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 490.93507,282.03324 0,56.58191 113.26111,0 0,-56.58191 z"
id="path3180" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:1.06878722px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 64.811308,366.95197 0,33.8571 548.659552,0 0,-33.8571 z"
id="path3190" />
<text
xml:space="preserve"
x="64.141869"
y="77.413521"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
id="text3154"
transform="scale(0.99367712,1.0063631)"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 344.38206,197.16036 0,56.58192 130.48776,0 0,-56.58192 -130.48776,0 z"
id="path3156" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:1.11373937px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 344.4504,197.2287 0,56.44524 169.95611,0 0,-56.44524 z"
id="path3158" />
<text
xml:space="preserve"
x="356.4809"
y="214.69417"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
id="text3160"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="463.68921"
y="186.10809"
style="font-size:31.02789688px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3162"
transform="scale(0.78359294,1.2761728)">Visualization</text>
<text
xml:space="preserve"
x="448.87256"
y="246.24217"
style="font-size:12.97547531px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3164"
transform="scale(0.99367712,1.0063631)"> </text>
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 344.38206,282.03324 0,56.58191 130.48776,0 0,-56.58191 z"
id="path3168" />
<text
xml:space="preserve"
x="356.4809"
y="299.0304"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000"
id="text3170"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="459.00015"
y="261.70831"
style="font-size:34.08923721px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3172"
transform="scale(0.82314176,1.2148576)">Shape</text>
<text
xml:space="preserve"
x="429.33118"
y="330.5784"
style="font-size:12.97547531px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3176"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="525.31842"
y="299.0304"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
id="text3182"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="628.04413"
y="255.03328"
style="font-size:31.91677094px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3184"
transform="scale(0.79737332,1.2541177)">Graphic</text>
<text
xml:space="preserve"
x="594.88574"
y="330.5784"
style="font-size:12.97547531px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3186"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="309.66422"
y="358.04483"
style="font-size:38.11062622px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3192"
transform="scale(0.89965906,1.1115322)">Kernel</text>
<text
xml:space="preserve"
x="370.39435"
y="381.80484"
style="font-size:12.97547531px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Times New Roman"
id="text3194"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="351.32196"
y="398.35971"
style="font-size:14.38245487px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
id="text3196"
transform="scale(0.99367712,1.0063631)"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15633102px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 270.30308,196.72815 70.26338,79.98089 c 0.23301,0.26523 0.21359,0.68762 -0.0583,0.92338 -0.26213,0.23576 -0.66991,0.21611 -0.91263,-0.0589 l -70.26338,-79.97107 c -0.23302,-0.27505 -0.2136,-0.68763 0.0583,-0.92339 0.26214,-0.24557 0.66992,-0.2161 0.91264,0.0491 z m 71.81681,76.82762 2.26217,8.47747 -8.0681,-3.26132 z"
id="path3200" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15633102px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 409.43296,253.74228 0,21.74868 c 0,0.37328 -0.27185,0.64833 -0.64079,0.64833 -0.34951,0 -0.64079,-0.27505 -0.64079,-0.64833 l 0,-21.74868 c 0,-0.35363 0.29128,-0.64833 0.64079,-0.64833 0.36894,0 0.64079,0.2947 0.64079,0.64833 z m 3.24277,20.43236 -3.88356,7.8586 -3.88356,-7.8586 z"
id="path3202" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.11878665px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 491.26208,253.69332 25.41321,24.57851 c 0.19618,0.18973 0.19618,0.49624 0,0.68598 -0.19618,0.18974 -0.51311,0.18974 -0.70929,0 l -25.4132,-24.5785 c -0.19618,-0.18974 -0.19618,-0.49624 0,-0.68599 0.19619,-0.18974 0.5131,-0.18974 0.70928,0 z m 26.48466,22.17028 2.12784,6.18842 -6.39858,-2.05795 z"
id="path3204" />
<path
inkscape:connector-curvature="0"
style="fill:#1c1c1c;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 157.97099,65.135894 0,66.012236 335.53993,0 0,-66.012236 -335.53993,0 z"
id="path3206" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 157.97099,65.135894 0,66.012236 335.53993,0 0,-66.012236 z"
id="path3208" />
<path
inkscape:connector-curvature="0"
style="fill:#1c1c1c;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 157.97099,131.14813 0,132.02447 139.80831,0 0,-132.02447 -139.80831,0 z"
id="path3210" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 157.97099,131.14813 0,132.02447 139.80831,0 0,-132.02447 z"
id="path3212" />
<path
inkscape:connector-curvature="0"
style="fill:#1c1c1c;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 167.29154,263.1726 0,75.44255 130.48776,0 0,-75.44255 -130.48776,0 z"
id="path3214" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 167.29154,263.1726 0,75.44255 130.48776,0 0,-75.44255 z"
id="path3216" />
<path
inkscape:connector-curvature="0"
style="fill:#1c1c1c;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 64.765449,263.1726 0,75.44255 102.526091,0 0,-75.44255 -102.526091,0 z"
id="path3218" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 64.765449,263.1726 0,75.44255 102.526091,0 0,-75.44255 z"
id="path3220" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15633102px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 112.00901,338.61515 0,21.74868 c 0,0.36346 -0.28156,0.64833 -0.64079,0.64833 -0.35923,0 -0.6505,-0.28487 -0.6505,-0.64833 l 0,-21.74868 c 0,-0.35364 0.29127,-0.64833 0.6505,-0.64833 0.35923,0 0.64079,0.29469 0.64079,0.64833 z m 3.24277,20.43237 -3.88356,7.85859 -3.88357,-7.85859 z"
id="path3222" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15633102px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 233.17621,338.61515 0,21.74868 c 0,0.36346 -0.28156,0.64833 -0.64079,0.64833 -0.35924,0 -0.6505,-0.28487 -0.6505,-0.64833 l 0,-21.74868 c 0,-0.35364 0.29126,-0.64833 0.6505,-0.64833 0.35923,0 0.64079,0.29469 0.64079,0.64833 z m 3.24277,20.43237 -3.88356,7.85859 -3.88356,-7.85859 z"
id="path3224" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15633102px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 409.43296,338.61515 0,21.74868 c 0,0.37329 -0.27185,0.64833 -0.64079,0.64833 -0.34951,0 -0.64079,-0.27504 -0.64079,-0.64833 l 0,-21.74868 c 0,-0.35364 0.29128,-0.64833 0.64079,-0.64833 0.36894,0 0.64079,0.29469 0.64079,0.64833 z m 3.24277,20.43237 -3.88356,7.85859 -3.88356,-7.85859 z"
id="path3226" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15633102px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 550.32809,340.02962 0,21.74868 c 0,0.37329 -0.27185,0.64833 -0.64079,0.64833 -0.34952,0 -0.64078,-0.27504 -0.64078,-0.64833 l 0,-21.74868 c 0,-0.35364 0.29126,-0.64833 0.64078,-0.64833 0.36894,0 0.64079,0.29469 0.64079,0.64833 z m 3.24278,20.43237 -3.88357,7.85859 -3.88356,-7.85859 z"
id="path3228" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 83.406557,414.05771 0,18.86064 46.602773,0 0,-18.86064 -46.602773,0 z"
id="path3230" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 83.406557,414.05771 0,18.86064 46.602773,0 0,-18.86064 z"
id="path3232" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 139.32988,414.05771 0,28.29096 344.86049,0 0,-28.29096 -344.86049,0 z"
id="path3234" />
<text
xml:space="preserve"
x="149.65495"
y="429.43918"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3236"
transform="scale(0.99367712,1.0063631)">OCAF (Open CASCADE Application Framework)</text>
<text
xml:space="preserve"
x="461.06635"
y="429.43918"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3238"
transform="scale(0.99367712,1.0063631)"> </text>
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.97706896px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 83.406557,451.77899 0,18.86063 46.602773,0 0,-18.86063 z"
id="path3242" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 139.32988,451.77899 0,28.29096 354.18104,0 0,-28.29096 -354.18104,0 z"
id="path3244" />
<text
xml:space="preserve"
x="149.65495"
y="466.92197"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3246"
transform="scale(0.99367712,1.0063631)">OCCT</text>
<text
xml:space="preserve"
x="190.30101"
y="466.92197"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3248"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="194.20929"
y="466.92197"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3250"
transform="scale(0.99367712,1.0063631)">Object Libraries required by OCAF</text>
<text
xml:space="preserve"
x="414.01071"
y="466.92197"
style="font-size:14.38245487px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3252"
transform="scale(0.99367712,1.0063631)"> </text>
<text
xml:space="preserve"
x="425.57922"
y="504.24854"
style="font-size:14.38245487px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3258"
transform="scale(0.99367712,1.0063631)"> </text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -44,8 +44,7 @@ The table below contrasts the design of a modeling application using object libr
The relationship between OCAF and the Open CASCADE Technology (**OCCT**) Object Libraries can be seen in the image below.
@image html /user_guides/ocaf/images/ocaf_image003.png "OCAF Architecture"
@image latex /user_guides/ocaf/images/ocaf_image003.png "OCAF Architecture"
@figure{/user_guides/ocaf/images/ocaf_image003.svg, "OCAF Architecture"}
In the image, the OCAF (Open CASCADE Application Framework) is shown with black rectangles and OCCT Object Libraries required by OCAF are shown with white rectangles.
@@ -80,7 +79,7 @@ OCAF documents are in turn managed by an OCAF application, which is in charge of
Apart from their role as a container of application data, documents can refer to each other; Document A, for example, can refer to a specific label in Document B. This functionality is made possible by means of the reference key.
@subsection occt_ocaf_23 The document and the data framework
@subsection occt_ocaf_2_3 The document and the data framework
Inside a document, there is a data framework, a model, for example. This is a set of labels organized in a tree structure characterized by the following features:
* The first label in a framework is the root of the tree;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -0,0 +1,398 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="492.48849"
height="306.85541"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="shape_heal.svg">
<defs
id="defs4">
<clipPath
id="clipEmfPath1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3045"
height="188.43307"
width="602.36218"
y="0"
x="0" />
</clipPath>
<clipPath
id="clipEmfPath2"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3048"
height="168.77963"
width="461.37103"
y="13.50237"
x="1.4999058" />
</clipPath>
<clipPath
id="clipEmfPath1-1"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3221"
height="352.24017"
width="546.80316"
y="0"
x="0" />
</clipPath>
<clipPath
id="clipEmfPath2-7"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3224"
height="11.251283"
width="140.71368"
y="141.16611"
x="0.60005832" />
</clipPath>
<clipPath
id="clipEmfPath3"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3227"
height="11.251283"
width="140.86369"
y="141.16611"
x="177.31725" />
</clipPath>
<clipPath
id="clipEmfPath4"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3230"
height="11.251283"
width="140.86369"
y="140.86607"
x="350.28406" />
</clipPath>
<clipPath
id="clipEmfPath5"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3233"
height="11.251283"
width="140.71368"
y="276.48154"
x="175.06702" />
</clipPath>
<clipPath
id="clipEmfPath6"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3236"
height="11.251283"
width="140.71368"
y="214.07442"
x="175.96712" />
</clipPath>
<clipPath
id="clipEmfPath7"
clipPathUnits="userSpaceOnUse">
<rect
id="rect3239"
height="11.251283"
width="140.86369"
y="336.18835"
x="174.01692" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="346.95854"
inkscape:cy="41.972723"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="915"
inkscape:window-height="838"
inkscape:window-x="132"
inkscape:window-y="132"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-28.041461,-50.336628)">
<g
id="g2989" />
<g
id="g3000" />
<g
id="g3011" />
<g
id="g3022" />
<g
id="g3033" />
<g
id="g3209" />
<text
xml:space="preserve"
x="77.124359"
y="50.336628"
style="font-size:19.95194054px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3245"> </text>
<text
xml:space="preserve"
x="384.65424"
y="50.336628"
style="font-size:19.95194054px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3249"> </text>
<text
xml:space="preserve"
x="384.35422"
y="74.039337"
style="font-size:12.45121098px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3253"> </text>
<text
xml:space="preserve"
x="43.821121"
y="95.941833"
style="font-size:12.45121098px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3255"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath1-1)"
d="m -0.00937591,136.00926 0,21.24618 141.76378591,0 0,-21.24618 -141.76378591,0 z"
id="path3257"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 28.510257,137.89036 0,21.24618 141.763783,0 0,-21.24618 z"
id="path3259" />
<text
xml:space="preserve"
x="74.574112"
y="153.24837"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3261">ShapeFix</text>
<text
xml:space="preserve"
x="124.52896"
y="153.24837"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3263"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath2-7)"
d="m 176.82969,136.00926 0,21.24618 141.76378,0 0,-21.24618 -141.76378,0 z"
id="path3265"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 205.34932,137.89036 0,21.24618 141.76378,0 0,-21.24618 z"
id="path3267" />
<text
xml:space="preserve"
x="236.58987"
y="153.24837"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3269">ShapeUpgrade</text>
<text
xml:space="preserve"
x="315.94757"
y="153.24837"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3271"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath3)"
d="m 349.77776,135.82174 0,21.24617 141.76378,0 0,-21.24617 -141.76378,0 z"
id="path3273"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 378.29739,137.70284 0,21.24617 141.76378,0 0,-21.24617 z"
id="path3275" />
<text
xml:space="preserve"
x="411.35684"
y="152.94833"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3277">ShapeCustom</text>
<text
xml:space="preserve"
x="486.9642"
y="152.94833"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3279"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath4)"
d="m 174.44821,271.3997 0,21.24618 141.76378,0 0,-21.24618 -141.76378,0 z"
id="path3281"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 202.96784,273.2808 0,21.24618 141.76378,0 0,-21.24618 z"
id="path3283" />
<text
xml:space="preserve"
x="238.39005"
y="288.56381"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3285">ShapeExtend</text>
<text
xml:space="preserve"
x="309.64694"
y="288.56381"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3287"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
clip-path="url(#clipEmfPath5)"
d="m 175.3858,208.95508 0,21.24617 141.76378,0 0,-21.24617 -141.76378,0 z"
id="path3289"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 203.90543,210.83618 0,21.24617 141.76378,0 0,-21.24617 z"
id="path3291" />
<text
xml:space="preserve"
x="234.78969"
y="226.15668"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3293">ShapeAnalysis</text>
<text
xml:space="preserve"
x="314.89746"
y="226.15668"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3295"> </text>
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
clip-path="url(#clipEmfPath6)"
d="m 74.257219,158.83061 0,182.75835"
id="path3297"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 103.83926,342.96989 92.18396,0 c 0.35629,0 0.63756,0.28128 0.63756,0.63757 0,0.33754 -0.28127,0.61882 -0.63756,0.61882 l -92.18396,0 c -0.35628,0 -0.63756,-0.28128 -0.63756,-0.61882 0,-0.35629 0.28128,-0.63757 0.63756,-0.63757 z m 90.94634,-3.11286 7.50073,3.75043 -7.50073,3.75043 z"
id="path3299" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 103.70507,285.15091 94.06852,0 c 0.3469,0 0.62818,0.28128 0.62818,0.62819 0,0.34692 -0.28128,0.6282 -0.62818,0.6282 l -94.06852,0 c -0.34691,0 -0.62819,-0.28128 -0.62819,-0.6282 0,-0.34691 0.28128,-0.62819 0.62819,-0.62819 z m 92.82152,-3.12223 7.50073,3.75042 -7.50073,3.75043 z"
id="path3301" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 104.38951,221.9562 91.26512,0 c 0.34691,0 0.61881,0.28128 0.61881,0.6282 0,0.34691 -0.2719,0.62819 -0.61881,0.62819 l -91.26512,0 c -0.33753,0 -0.61881,-0.28128 -0.61881,-0.62819 0,-0.34692 0.28128,-0.6282 0.61881,-0.6282 z m 90.00875,-3.12223 7.50073,3.75043 -7.50073,3.75042 z"
id="path3303" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 276.34372,233.58253 0,33.00376 c 0,0.34691 -0.2719,0.6282 -0.61881,0.6282 -0.3469,0 -0.62818,-0.28129 -0.62818,-0.6282 l 0,-33.00376 c 0,-0.33754 0.28128,-0.61882 0.62818,-0.61882 0.34691,0 0.61881,0.28128 0.61881,0.61882 z m 3.13156,31.75674 -3.75037,7.50086 -3.75036,-7.50086 z"
id="path3305" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
d="m 453.74242,160.71171 0,59.06924"
id="path3307" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 452.98619,220.39977 -100.62228,0 c -0.35629,0 -0.63757,-0.28128 -0.63757,-0.61882 0,-0.35629 0.28128,-0.63757 0.63757,-0.63757 l 100.62228,0 c 0.35628,0 0.63756,0.28128 0.63756,0.63757 0,0.33754 -0.28128,0.61882 -0.63756,0.61882 z m -99.38466,3.13161 -7.50073,-3.75043 7.50073,-3.75043 z"
id="path3309" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 275.65928,158.82712 0,47.18976 c 0,0.34692 -0.28127,0.6282 -0.62818,0.6282 -0.33754,0 -0.61881,-0.28128 -0.61881,-0.6282 l 0,-47.18976 c 0,-0.34691 0.28127,-0.62819 0.61881,-0.62819 0.34691,0 0.62818,0.28128 0.62818,0.62819 z m 3.12218,45.94274 -3.75036,7.50086 -3.75037,-7.50086 z"
id="path3311" />
<path
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 202.03025,332.9126 0,21.24618 141.76378,0 0,-21.24618 -141.76378,0 z"
id="path3313" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.93759114px;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 202.03025,332.9126 0,21.24618 141.76378,0 0,-21.24618 z"
id="path3315" />
<text
xml:space="preserve"
x="249.19109"
y="348.2706"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3317">Message</text>
<text
xml:space="preserve"
x="296.7457"
y="348.2706"
style="font-size:11.25109386px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial"
id="text3319"> </text>
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
clip-path="url(#clipEmfPath7)"
d="m 174.31695,148.19815 -25.62437,0 c -0.34691,0 -0.62818,-0.28128 -0.62818,-0.62819 0,-0.34692 0.28127,-0.6282 0.62818,-0.6282 l 25.62437,0 c 0.34691,0 0.62818,0.28128 0.62818,0.6282 0,0.34691 -0.28127,0.62819 -0.62818,0.62819 z m -24.37737,3.12223 -7.50073,-3.75042 7.50073,-3.75043 z"
id="path3321"
transform="translate(28.519633,1.8811043)" />
<path
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.15001458px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none"
d="m 277.91888,297.09602 0,33.00376 c 0,0.35629 -0.28128,0.61882 -0.63756,0.61882 -0.33754,0 -0.61881,-0.26253 -0.61881,-0.61882 l 0,-33.00376 c 0,-0.33754 0.28127,-0.61882 0.61881,-0.61882 0.35628,0 0.63756,0.28128 0.63756,0.61882 z m 3.1128,31.74737 -3.75036,7.50086 -3.75037,-7.50086 z"
id="path3323" />
<g
id="g3389"
transform="translate(103.61121,159.85132)">
<text
id="text3391"
style="font-size:21.59645653px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Calibri"
y="197.34073"
x="-0.70423234"
xml:space="preserve"> </text>
<path
id="path3393"
d="m 0.74824682,0.41458137 0,183.67838863"
style="fill:none;stroke:#000000;stroke-width:1.46715069px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -14,8 +14,8 @@ The **Shape Healing** toolkit provides a set of tools to work on the geometry an
* upgrade shape characteristics for users needs, for example a C0 supporting surface can be upgraded so that it becomes C1 continuous.
The following diagram shows dependencies of API packages:
@image html /user_guides/shape_healing/images/shape_healing_image009.png "Shape Healing packages"
@image latex /user_guides/shape_healing/images/shape_healing_image009.png "Shape Healing packages"
@figure{/user_guides/shape_healing/images/shape_healing_image009.svg, "Shape Healing packages"}
Each sub-domain has its own scope of functionality:
* analysis - exploring shape properties, computing shape features, detecting violation of OCCT requirements (shape itself is not modified);

View File

@@ -257,20 +257,20 @@ Handle_AIS_Shape OCCDemo_Presentation::drawShape
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->GetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)

View File

@@ -50,10 +50,10 @@ public:
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void ResetView();

View File

@@ -1183,14 +1183,14 @@ void CViewer3dView::Reset()
}
}
void CViewer3dView::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void CViewer3dView::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const
{
myView->Center(Xc,Yc);
myView->At (theX, theY, theZ);
}
void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void CViewer3dView::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{
myView->SetCenter(Xc,Yc);
myView->SetAt (theX, theY, theZ);
}
void CViewer3dView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)

View File

@@ -39,17 +39,17 @@ protected: // create from serialization only
DECLARE_DYNCREATE(CViewer3dView)
public:
CViewer3dDoc* GetDocument();
void Redraw() { myView->Redraw(); };
void InitButtons();
void Reset();
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc);
void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
CViewer3dDoc* GetDocument();
void Redraw() { myView->Redraw(); };
void InitButtons();
void Reset();
void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale (const Quantity_Factor Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
// Overrides

View File

@@ -90,6 +90,8 @@ BEGIN
SEPARATOR
BUTTON ID_FILE_EXPORT_IMAGE
SEPARATOR
BUTTON ID_BUTTON_STEREO
SEPARATOR
BUTTON ID_APP_ABOUT
END
@@ -264,6 +266,11 @@ BEGIN
ID_FILE_MRU_FILE1 "Open recent file\nRecent file"
END
STRINGTABLE
BEGIN
ID_BUTTON_STEREO "Toggle stereographic mode on / off"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -135,6 +135,7 @@ void CAnimationView3D::OnInitialUpdate()
aViewer = GetDocument()->GetViewer();
aViewer->SetDefaultTypeOfView (V3d_PERSPECTIVE);
myView = aViewer->CreateView();
// store for restore state after rotation (witch is in Degenerated mode)
@@ -156,8 +157,6 @@ void CAnimationView3D::OnInitialUpdate()
/* I suspect another problem elsewhere */
::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
myPView = Handle(V3d_PerspectiveView)::DownCast (myView);
m_Tune.Create ( IDD_TUNE , NULL ) ;
RECT dlgrect;
@@ -892,37 +891,37 @@ void CAnimationView3D::Twist (int x , int /*y*/)
myView->SetTwist (a) ;
}
void CAnimationView3D::SetFocal(double dFocus,double dAngle)
//=============================================================================
// function: SetFocal
// purpose:
//=============================================================================
void CAnimationView3D::SetFocal (double theFocus, double theAngle)
{
double v [3] ;
double l ;
int i ;
v [0] = m_Atx - m_Eyex ;
v [1] = m_Aty - m_Eyey ;
v [2] = m_Atz - m_Eyez ;
Handle(Graphic3d_Camera) aCamera = myView->Camera();
l = sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] ) ;
if ( l > 1.e-3 ) {
for ( i=0 ; i<3 ; i++ )
v [i] = v [i] / l * dFocus ;
gp_Pnt anAt = aCamera->Center();
gp_Pnt anEye = aCamera->Eye();
m_Focus = dFocus ;
gp_Vec aLook (anAt, anEye);
m_Atx = v [0] + m_Eyex ;
m_Aty = v [1] + m_Eyey ;
m_Atz = v [2] + m_Eyez ;
if (aCamera->Distance() > 1.e-3)
{
aLook = aLook / aCamera->Distance() * theFocus;
myView->SetImmediateUpdate ( Standard_False ) ;
myView->SetAt ( m_Atx , m_Aty , m_Atz ) ;
m_dAngle = dAngle ;
dAngle = dAngle * M_PI / 180. ;
myPView->SetAngle ( dAngle ) ;
dAngle = myPView->Angle () ;
m_Focus = theFocus;
myView->SetImmediateUpdate ( Standard_True ) ;
myView->Update ();
}
anAt.SetX (aLook.X() + anEye.X());
anAt.SetY (aLook.Y() + anEye.Y());
anAt.SetZ (aLook.Z() + anEye.Z());
m_dAngle = theAngle;
aCamera->SetCenter (anAt);
aCamera->SetFOVy (theAngle);
myView->Update();
}
}
void CAnimationView3D::ReloadData()
@@ -958,9 +957,9 @@ void CAnimationView3D::ReloadData()
dy = m_Aty - m_Eyey ;
dz = m_Atz - m_Eyez ;
m_Focus = sqrt ( dx * dx + dy * dy + dz * dz ) ;
m_dAngle = myPView->Angle () ;
m_dAngle = m_dAngle * 180. / M_PI ;
m_Focus = sqrt (dx * dx + dy * dy + dz * dz);
m_dAngle = myView->Camera()->FOVy();
m_Tune.m_dAngle = m_dAngle ;
m_Tune.m_dFocus = m_Focus ;

View File

@@ -59,7 +59,7 @@ public:
void SetDimensions ();
void ReloadData();
CTune m_Tune;
void SetFocal ( double dFocus , double dAngle );
void SetFocal (double theFocus, double theAngle);
void Fly (int x , int y);
void Turn (int x , int y);
void Roll (int x , int y);
@@ -138,8 +138,6 @@ private:
Quantity_Factor myCurZoom;
Standard_Boolean myHlrModeIsOn;
Handle_V3d_PerspectiveView myPView;
View3D_CurrentAction myCurrentMode;
double m_Atx , m_Aty , m_Atz ;
double m_Eyex , m_Eyey , m_Eyez ;

View File

@@ -210,7 +210,6 @@ enum CurrentAction3d {
#include "HLRAlgo_Projector.hxx"
#include "Aspect_MarkMap.hxx"
#include <V3d_PerspectiveView.hxx>
#include <Geom_BSplineSurface.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>

View File

@@ -69,6 +69,7 @@ Convert_Presentation::Convert_Presentation()
myIndex = 0;
myNbFuncs = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
myNbSamples = myNbFuncs;
FitMode = true;
}
//////////////////////////////////////////////////////////////////////
@@ -84,7 +85,6 @@ void Convert_Presentation::DoSample()
(this->*SampleFuncs[myIndex])();
}
//================================================================
// Function : Convert_Presentation::drawSurfaceAndItsBSpline
// Purpose :
@@ -332,7 +332,7 @@ void Convert_Presentation::sampleRevolSurface()
{
FitMode=false;
ResetView();
SetViewCenter(176.84682,102.12892);
TranslateView(-176.84682, -102.12892);
SetViewScale(0.69326);
getAISContext()->EraseAll();

View File

@@ -257,20 +257,20 @@ Handle_AIS_Shape OCCDemo_Presentation::drawShape
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void OCCDemo_Presentation::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->GetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void OCCDemo_Presentation::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewAt (theX, theY, theZ);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
@@ -311,4 +311,12 @@ void OCCDemo_Presentation::ResetView()
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->Reset();
}
}
void OCCDemo_Presentation::TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->Translate (theX, theY);
}

View File

@@ -50,14 +50,14 @@ public:
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ);
static void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
static void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye (V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void ResetView();
static void TranslateView (const V3d_Coordinate theX, const V3d_Coordinate theY);
// place one-time initialization code in this function
virtual void Init() {}

View File

@@ -97,6 +97,8 @@ void COCCDemoView::OnInitialUpdate()
CView::OnInitialUpdate();
myView = GetDocument()->GetViewer()->CreateView();
myView->SetViewMappingDefault();
myView->SetViewOrientationDefault();
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd ());
myView->SetWindow(aWNTWindow);
@@ -543,14 +545,14 @@ void COCCDemoView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
pCmdUI->Enable (myVisMode != VIS_HLR);
}
void COCCDemoView::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
void COCCDemoView::GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const
{
myView->Center(Xc,Yc);
myView->At (theX, theY, theZ);
}
void COCCDemoView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
void COCCDemoView::SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ)
{
myView->SetCenter(Xc,Yc);
myView->SetAt (theX, theY, theZ);
}
void COCCDemoView::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
@@ -572,3 +574,8 @@ void COCCDemoView::SetViewScale(Quantity_Factor Coef)
{
myView->SetScale(Coef);
}
void COCCDemoView::Translate (const Standard_Real theX, const Standard_Real theY)
{
myView->Panning (theX, theY);
}

View File

@@ -27,13 +27,18 @@ protected: // create from serialization only
// Attributes
public:
COCCDemoDoc* GetDocument();
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
void FitAll()
{
myView->FitAll();
myView->ZFitAll();
};
void GetViewAt (V3d_Coordinate& theX, V3d_Coordinate& theY, V3d_Coordinate& theZ) const;
void SetViewAt (const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ);
void GetViewEye (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye (const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef);
void Translate (const V3d_Coordinate theX, const V3d_Coordinate theY);
// Operations

View File

@@ -9,7 +9,11 @@
#include <res\OCC_Resource.h>
#include <Visual3d_View.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_Camera.hxx>
#include <OpenGl_GraphicDriver.hxx>
#define ValZWMin 1
@@ -31,6 +35,7 @@ BEGIN_MESSAGE_MAP(OCC_3dView, CView)
ON_COMMAND(ID_BUTTONRot, OnBUTTONRot)
ON_COMMAND(ID_BUTTONTop, OnBUTTONTop)
ON_COMMAND(ID_BUTTONZoomAll, OnBUTTONZoomAll)
ON_COMMAND(ID_BUTTON_STEREOCONFIG, OnStereoConfigButton)
ON_WM_SIZE()
ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
ON_COMMAND(ID_BUTTONZoomProg, OnBUTTONZoomProg)
@@ -49,6 +54,7 @@ BEGIN_MESSAGE_MAP(OCC_3dView, CView)
ON_UPDATE_COMMAND_UI(ID_BUTTONZoomProg, OnUpdateBUTTONZoomProg)
ON_UPDATE_COMMAND_UI(ID_BUTTONZoomWin, OnUpdateBUTTONZoomWin)
ON_UPDATE_COMMAND_UI(ID_BUTTONRot, OnUpdateBUTTONRot)
ON_UPDATE_COMMAND_UI(ID_BUTTON_STEREOCONFIG, OnUpdateStereoConfigButton)
ON_COMMAND(ID_Modify_ChangeBackground , OnModifyChangeBackground)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -73,9 +79,13 @@ OCC_3dView::OCC_3dView()
OCC_3dView::~OCC_3dView()
{
if ( myView )
if (myView)
{
myView->Remove();
if (m_Pen) delete m_Pen;
}
delete m_pStereoDlg;
delete m_Pen;
}
BOOL OCC_3dView::PreCreateWindow(CREATESTRUCT& cs)
@@ -97,15 +107,27 @@ void OCC_3dView::OnInitialUpdate()
myHlrModeIsOn = Standard_False;
myView->SetComputedMode (myHlrModeIsOn);
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
((OCC_App*)AfxGetApp())->GetGraphicDriver();
Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast (((OCC_App*)AfxGetApp())->GetGraphicDriver());
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd());
myView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
myView->Camera()->SetProjectionType (aDriver->Options().contextStereo
? Graphic3d_Camera::Projection_Stereo
: Graphic3d_Camera::Projection_Orthographic);
if (!aWNTWindow->IsMapped())
{
aWNTWindow->Map();
}
// store the mode ( nothing , dynamic zooming, dynamic ... )
myCurrentMode = CurAction3d_Nothing;
m_pStereoDlg = new OCC_StereoConfigDlg (this);
m_pStereoDlg->SetView (myView);
m_pStereoDlg->Create (IDD_DIALOG_STEREO, this);
}
void OCC_3dView::OnDraw(CDC* /*pDC*/)
@@ -600,3 +622,33 @@ void OCC_3dView::OnModifyChangeBackground()
}
myView->Redraw();
}
//=============================================================================
// function: OnStereoConfigButton
// purpose: Open stereographic configuration dialog
//=============================================================================
void OCC_3dView::OnStereoConfigButton()
{
m_pStereoDlg->ShowWindow (SW_SHOW);
}
//=============================================================================
// function: OnUpdateStereoConfigButton
// purpose: Enable / disable state of stereo configuration button
//=============================================================================
void OCC_3dView::OnUpdateStereoConfigButton (CCmdUI* theCmdUI)
{
// get camera
Handle(Graphic3d_Camera) aCamera = myView->Camera();
// check that button is enabled
Standard_Boolean isEnabled = !aCamera.IsNull() && aCamera->IsStereo();
// update toggle state
theCmdUI->Enable (isEnabled);
if (!isEnabled)
{
m_pStereoDlg->ShowWindow (SW_HIDE);
}
}

View File

@@ -11,6 +11,7 @@
#include "OCC_BaseView.h"
#include "OCC_3dDoc.h"
#include "OCC_StereoConfigDlg.h"
#include <Standard_Macro.hxx>
enum CurAction3d {
@@ -81,6 +82,8 @@ protected:
afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
afx_msg void OnModifyChangeBackground();
afx_msg void OnStereoConfigButton();
afx_msg void OnUpdateStereoConfigButton (CCmdUI* theCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
@@ -111,6 +114,11 @@ protected:
const Standard_Integer MaxY ,
const Standard_Boolean Draw ,
const LineStyle aLineStyle = Default );
private:
//! Persistent non blocking stereo configuration dialog
OCC_StereoConfigDlg* m_pStereoDlg;
};
#ifndef _DEBUG // debug version in OCC_3dView.cpp

View File

@@ -5,11 +5,13 @@
#include <stdafx.h>
#include "OCC_App.h"
#include "OCC_BaseDoc.h"
#include <res\OCC_Resource.h>
#include <Standard_Version.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OSD.hxx>
#include "afxwin.h"
/////////////////////////////////////////////////////////////////////////////
@@ -24,6 +26,8 @@ BEGIN_MESSAGE_MAP(OCC_App, CWinApp)
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
ON_COMMAND(ID_BUTTON_STEREO, &OCC_App::OnStereo)
ON_UPDATE_COMMAND_UI(ID_BUTTON_STEREO, &OCC_App::OnUpdateStereo)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
@@ -174,3 +178,57 @@ void OCC_App::SetSampleName(LPCTSTR Name)
{
SampleName = Name;
}
//=============================================================================
// function: OnStereo
// purpose:
//=============================================================================
void OCC_App::OnStereo()
{
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (myGraphicDriver);
int anAnswer = MessageBox(NULL,
"It is required to switch OpenGl context to turn on / off hardware stereo support. "
"The document views need to be re-created to change \"GL\" context pixel format. "
"This will close all current views and open new one (the model will be kept).\n"
"Do you want to continue?", "Enable/disable hardware stereo support", MB_OKCANCEL | MB_ICONQUESTION);
if (anAnswer != IDOK)
{
return;
}
Standard_Boolean& aStereoMode = aDriver->ChangeOptions().contextStereo;
aStereoMode = !aStereoMode;
// reset document views
POSITION aTemplateIt = GetFirstDocTemplatePosition();
while (aTemplateIt != NULL)
{
CDocTemplate* aTemplate = (CDocTemplate*)GetNextDocTemplate (aTemplateIt);
POSITION aDocumentIt = aTemplate->GetFirstDocPosition();
while (aDocumentIt != NULL)
{
OCC_BaseDoc* aDocument = dynamic_cast<OCC_BaseDoc*> (aTemplate->GetNextDoc (aDocumentIt));
if (aDocument == NULL)
continue;
aDocument->ResetDocumentViews (aTemplate);
}
}
}
//=============================================================================
// function: OnUpdateStereo
// purpose:
//=============================================================================
void OCC_App::OnUpdateStereo (CCmdUI* theCmdUI)
{
Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast (myGraphicDriver);
theCmdUI->SetCheck (!aDriver.IsNull() && aDriver->Options().contextStereo);
}

View File

@@ -27,11 +27,13 @@ public:
}
// Implementation
//{{AFX_MSG(OCC_BaseApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
//{{AFX_MSG(OCC_BaseApp)
afx_msg void OnAppAbout();
afx_msg void OnStereo();
afx_msg void OnUpdateStereo (CCmdUI* theCmdUI);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
protected:
Handle_Graphic3d_GraphicDriver myGraphicDriver;

View File

@@ -66,4 +66,40 @@ OCC_BaseDoc::OCC_BaseDoc()
OCC_BaseDoc::~OCC_BaseDoc()
{
}
//=============================================================================
// function: ResetDocumentViews
// purpose:
//=============================================================================
void OCC_BaseDoc::ResetDocumentViews (CDocTemplate* theTemplate)
{
// do not delete document if no views
BOOL isAutoDelete = m_bAutoDelete;
m_bAutoDelete = FALSE;
// close all opened views
POSITION aViewIt = GetFirstViewPosition();
while (aViewIt)
{
CView* aView = GetNextView (aViewIt);
if (aView == NULL)
{
continue;
}
RemoveView (aView);
aView->GetParentFrame()->SendMessage (WM_CLOSE);
}
// create new view frame
CFrameWnd* aNewFrame = theTemplate->CreateNewFrame (this, NULL);
m_bAutoDelete = isAutoDelete;
// init frame
theTemplate->InitialUpdateFrame(aNewFrame, this);
}

View File

@@ -68,6 +68,11 @@ public:
virtual void Popup (const Standard_Integer /*theMouseX*/,
const Standard_Integer /*theMouseY*/,
const Handle(V3d_View)& /*theView*/) {}
public:
void ResetDocumentViews (CDocTemplate* theTemplate);
protected:
Handle(V3d_Viewer) myViewer;

View File

@@ -0,0 +1,250 @@
///////////////////////////////////////////////////////////////////////////////
// OCC_StereoConfigDlg.cpp : source file
///////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "OCC_StereoConfigDlg.h"
#include <Graphic3d_Camera.hxx>
BEGIN_MESSAGE_MAP (OCC_StereoConfigDlg, CDialog)
ON_WM_HSCROLL()
ON_NOTIFY (UDN_DELTAPOS, IDC_SPIN_FOCUS, OnSpinFocus)
ON_NOTIFY (UDN_DELTAPOS, IDC_SPIN_IOD, OnSpinIOD)
ON_BN_CLICKED (IDC_CHECK_FOCUS_RELATIVE, OnCheckFocus)
ON_BN_CLICKED (IDC_CHECK_IOD_RELATIVE, OnCheckIOD)
ON_EN_CHANGE (IDC_EDIT_FOCUS, OnChangeFocus)
ON_EN_CHANGE (IDC_EDIT_IOD, OnChangeIOD)
END_MESSAGE_MAP()
// round up value macro
#define ROUND_UP(X) X = (Round(X * 10000.0) / 10000.0)
// slider tick conversion
#define TO_SLIDER(X) (Standard_Integer)Round(X * 10)
// back conversion from slider ticks
#define FROM_SLIDER(X) X / 10.0
// ============================================================================
// function: SetView
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::SetView (const Handle(V3d_View)& theView)
{
myView = theView;
// access initial values
myIOD = myView->Camera()->IOD();
myFocus = myView->Camera()->ZFocus();
mySliderFocus = TO_SLIDER(myFocus);
myIsRelativeIOD = (myView->Camera()->GetIODType() == Graphic3d_Camera::IODType_Relative);
myIsRelativeFocus = (myView->Camera()->ZFocusType() == Graphic3d_Camera::FocusType_Relative);
}
// ============================================================================
// function: DoDataExchange
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::DoDataExchange(CDataExchange* theDX)
{
CDialog::DoDataExchange(theDX);
DDX_Text (theDX, IDC_EDIT_IOD, myIOD);
DDV_MinMaxDouble (theDX, myIOD, -DBL_MAX, DBL_MAX);
if (myIsRelativeFocus)
{
// do slider data exchange
DDX_Slider (theDX, IDC_SLIDER_FOCUS, (int&)mySliderFocus);
DDV_MinMaxSlider (theDX, mySliderFocus, TO_SLIDER(0.1), TO_SLIDER(10));
// show up value in edit field
Standard_Real aEditValue = FROM_SLIDER (mySliderFocus);
DDX_Text (theDX, IDC_EDIT_FOCUS, aEditValue);
// update focus value correspondingly
myFocus = FROM_SLIDER (mySliderFocus);
}
else
{
DDX_Text (theDX, IDC_EDIT_FOCUS, myFocus);
DDV_MinMaxDouble (theDX, myFocus, 50, DBL_MAX);
mySliderFocus = TO_SLIDER(1.0);
DDX_Slider (theDX, IDC_SLIDER_FOCUS, (int&)mySliderFocus);
}
DDX_Check (theDX, IDC_CHECK_FOCUS_RELATIVE, (int&)myIsRelativeFocus);
DDX_Check (theDX, IDC_CHECK_IOD_RELATIVE, (int&)myIsRelativeIOD);
CEdit* aFocusEdit = (CEdit*) GetDlgItem (IDC_EDIT_FOCUS);
aFocusEdit->EnableWindow (myIsRelativeFocus != Standard_True);
CSliderCtrl* aSlider = (CSliderCtrl*) GetDlgItem (IDC_SLIDER_FOCUS);
aSlider->EnableWindow (myIsRelativeFocus == Standard_True);
}
// ============================================================================
// function: OnHScroll
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnHScroll(UINT theSBCode, UINT thePos, CScrollBar* theScrollBar)
{
UpdateData (true);
UpdateData (false);
UpdateCamera();
CWnd::OnHScroll(theSBCode, thePos, theScrollBar);
}
// ============================================================================
// function: UpdateCamera
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::UpdateCamera()
{
// update camera properties and redraw view
const Handle(Graphic3d_Camera)& aCamera = myView->Camera();
if (aCamera.IsNull())
{
return;
}
// change IOD
Graphic3d_Camera::IODType aIODType =
myIsRelativeIOD ? Graphic3d_Camera::IODType_Relative :
Graphic3d_Camera::IODType_Absolute;
aCamera->SetIOD (aIODType, myIOD);
// change Focus
Graphic3d_Camera::FocusType aFocusType =
myIsRelativeFocus ? Graphic3d_Camera::FocusType_Relative :
Graphic3d_Camera::FocusType_Absolute;
aCamera->SetZFocus (aFocusType, myFocus);
// redraw view
myView->Redraw();
}
// ============================================================================
// function: OnCheckFocus
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnCheckFocus()
{
UpdateData (true);
// change focus to some predefined values
if (myIsRelativeFocus)
myFocus = 1.0;
else
myFocus = 100.0;
UpdateData (false);
UpdateCamera();
}
// ============================================================================
// function: OnCheckIOD
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnCheckIOD()
{
UpdateData (true);
UpdateCamera();
}
// ============================================================================
// function: OnChangeFocus
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnChangeFocus()
{
// keep previous value
Standard_Real aPrevFocus = myFocus;
// read data from ui controls
if (UpdateData (true))
{
UpdateCamera();
}
else
{
// revert back
myFocus = aPrevFocus;
UpdateData (false);
}
}
// ============================================================================
// function: OnChangeIOD
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnChangeIOD()
{
// keep previous value
Standard_Real aPrevIOD = myIOD;
// read data from ui controls
if (UpdateData (true))
{
UpdateCamera();
}
else
{
// revert back
myIOD = aPrevIOD;
UpdateData (false);
}
}
// ============================================================================
// function: OnSpinFocus
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnSpinFocus (NMHDR* theNMHDR, LRESULT* theResult)
{
NM_UPDOWN* aNMUpDown = (NM_UPDOWN*)theNMHDR;
const double aStep = 0.1; // use small incremental step
const double aDelta = aNMUpDown->iDelta * aStep; // get delta
// changes value
myFocus -= (Standard_Real)aDelta;
// round up value
ROUND_UP (myFocus);
// actualize view & ui controls
UpdateData (false);
UpdateCamera();
*theResult = 0;
}
// ============================================================================
// function: OnSpinIOD
// purpose:
// ============================================================================
void OCC_StereoConfigDlg::OnSpinIOD (NMHDR* theNMHDR, LRESULT* theResult)
{
NM_UPDOWN* aNMUpDown = (NM_UPDOWN*)theNMHDR;
const double aStep = 0.01; // use small incremental step
const double aDelta = aNMUpDown->iDelta * aStep; // get delta
// changes value
myIOD -= (Standard_Real)aDelta;
// round up value
ROUND_UP (myIOD);
// actualize view & ui controls
UpdateData (false);
UpdateCamera();
*theResult = 0;
}

View File

@@ -0,0 +1,55 @@
///////////////////////////////////////////////////////////////////////////////
// OCC_StereoConfigDlg.h : header file
///////////////////////////////////////////////////////////////////////////////
#ifndef OCC_StereoConfigDlg_Header
#define OCC_StereoConfigDlg_Header
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "res\OCC_Resource.h"
#include <V3d_View.hxx>
// Dialog to dynamically configure 3D Viewer stereo
// projection properties.
class AFX_EXT_CLASS OCC_StereoConfigDlg : public CDialog
{
public:
OCC_StereoConfigDlg (CWnd* theParent = NULL)
: CDialog (IDD_DIALOG_STEREO, theParent) {}
void SetView (const Handle(V3d_View)& theView);
protected:
virtual void DoDataExchange (CDataExchange* theDX);
void UpdateCamera();
// Implementation
protected:
afx_msg void OnCheckFocus();
afx_msg void OnCheckIOD();
afx_msg void OnChangeFocus();
afx_msg void OnChangeIOD();
afx_msg void OnSpinFocus (NMHDR* theNMHDR, LRESULT* theResult);
afx_msg void OnSpinIOD (NMHDR* theNMHDR, LRESULT* theResult);
afx_msg void OnHScroll(UINT theSBCode, UINT thePos, CScrollBar* theScrollBar);
DECLARE_MESSAGE_MAP()
private:
Standard_Real myIOD;
Standard_Real myFocus;
Standard_Integer mySliderFocus;
Standard_Boolean myIsRelativeIOD;
Standard_Boolean myIsRelativeFocus;
Handle(V3d_View) myView;
};
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

View File

@@ -5,6 +5,7 @@
#define IDD_ParamsFacesPage 101
#define IDR_POPUP 116
#define IDD_Dimension 119
#define IDD_DIALOG_STEREO 120
#define IDD_LengthParamsEdgePage 122
#define IDD_LengthParamsVerticesPage 123
#define IDD_LengthParamsEdgesPage 125
@@ -62,10 +63,17 @@
#define IDC_TextDisplayMode 1047
#define IDC_TextDisplayModeStatic 1048
#define IDC_DimensionColor 1049
#define IDC_FacesSt1 1052
#define IDC_FacesSt2 1053
#define IDC_FacesBtn1 1054
#define IDC_FacesBtn2 1055
#define IDC_EDIT_IOD 1050
#define IDC_SPIN_IOD 1051
#define IDC_CHECK_IOD_RELATIVE 1052
#define IDC_CHECK_FOCUS_RELATIVE 1053
#define IDC_SLIDER_FOCUS 1054
#define IDC_EDIT_FOCUS 1055
#define IDC_SPIN_FOCUS 1056
#define IDC_FacesSt1 1057
#define IDC_FacesSt2 1058
#define IDC_FacesBtn1 1059
#define IDC_FacesBtn2 1060
#define ID_WINDOW_NEW3D 1151
#define ID_OBJECT_DISPLAYALL 1201
#define ID_OBJECT_MATERIAL 1205
@@ -140,6 +148,9 @@
#define ID_OBJECT_DIMENSIONS 40035
#define ID_OBJECT_DIM 40036
#define ID_LOCALCONTEXT_ADDDIMENSION 40037
#define ID_BUTTON_STEREOSETTINGS 40038
#define ID_BUTTON_STEREO 40039
#define ID_BUTTON_STEREOCONFIG 40040
#define ID_FILE_IMPORT_CSFDB 40100
#define ID_FILE_IMPORT_BREP 40101
#define ID_FILE_IMPORT_STEP 40102
@@ -180,8 +191,8 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 40038
#define _APS_NEXT_CONTROL_VALUE 1055
#define _APS_NEXT_COMMAND_VALUE 40041
#define _APS_NEXT_CONTROL_VALUE 1061
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -280,6 +280,25 @@ BEGIN
PUSHBUTTON "Change dimension color",IDC_DimensionColor,105,156,63,24,BS_MULTILINE
CONTROL "",IDC_Flyout,"msctls_trackbar32",TBS_TOP | TBS_TOOLTIPS | WS_TABSTOP,73,112,100,20
END
IDD_DIALOG_STEREO DIALOGEX 0, 0, 166, 177
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Configure stereo"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT_IOD,88,42,41,12,ES_AUTOHSCROLL | WS_GROUP
CONTROL "",IDC_SPIN_IOD,"msctls_updown32",UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP,130,42,11,12
GROUPBOX "Stereo focus properties:",IDC_STATIC,7,72,149,96
GROUPBOX "Eye separation properties:",IDC_STATIC,6,6,150,60
LTEXT "Intraocular distance:",IDC_STATIC,18,43,68,8
CONTROL "",IDC_CHECK_IOD_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,24,16,10
LTEXT "Relative to focal length:",IDC_STATIC,18,24,78,8
CONTROL "",IDC_CHECK_FOCUS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,90,16,10
LTEXT "Relative to focal length:",IDC_STATIC,18,90,78,8
CONTROL "",IDC_SLIDER_FOCUS,"msctls_trackbar32",TBS_TOP | WS_TABSTOP,18,108,126,24
LTEXT "Fixed value:",IDC_STATIC,18,146,40,8
EDITTEXT IDC_EDIT_FOCUS,67,144,41,12,ES_AUTOHSCROLL | WS_GROUP
CONTROL "",IDC_SPIN_FOCUS,"msctls_updown32",UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP,108,144,11,12
END
IDD_ParamsFacesPage DIALOGEX 0, 0, 134, 73
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
@@ -345,6 +364,8 @@ BEGIN
BUTTON ID_BUTTONRot
BUTTON ID_BUTTONReset
SEPARATOR
BUTTON ID_BUTTON_STEREOCONFIG
SEPARATOR
BUTTON ID_BUTTONHlrOff
BUTTON ID_BUTTONHlrOn
END
@@ -486,6 +507,14 @@ BEGIN
HORZGUIDE, 336
END
IDD_DIALOG_STEREO, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 159
TOPMARGIN, 7
BOTTOMMARGIN, 170
END
IDD_ParamsFacesPage, DIALOG
BEGIN
LEFTMARGIN, 7
@@ -657,6 +686,12 @@ BEGIN
ID_LOCALCONTEXT_ADDDIMENSION "Add new dimension for selected objetcs"
END
STRINGTABLE
BEGIN
ID_BUTTON_STEREOSETTINGS "Configure stereo properties"
ID_BUTTON_STEREO "Toggle stereographic mode on / off"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

View File

@@ -292,6 +292,22 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\OCC_StereoConfigDlg.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgePage.cpp" />
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp" />
@@ -739,6 +755,7 @@
<ClInclude Include="..\..\..\..\Common\OCC_BaseDoc.h" />
<ClInclude Include="..\..\..\..\Common\OCC_BaseView.h" />
<ClInclude Include="..\..\..\..\Common\OCC_MainFrame.h" />
<ClInclude Include="..\..\..\..\Common\OCC_StereoConfigDlg.h" />
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h" />
<ClInclude Include="..\..\..\..\Common\ParamsFacesPage.h" />
<ClInclude Include="..\..\..\..\Common\res\OCC_Resource.h" />

View File

@@ -120,6 +120,9 @@
<ClCompile Include="..\..\..\..\Common\ISession2D\ISession2D_Shape.cpp">
<Filter>Source Files\ISession2D-src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\OCC_StereoConfigDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\DimensionDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -232,6 +235,9 @@
<ClInclude Include="..\..\..\..\Common\ISession2D\ISession2D_Shape.h">
<Filter>Header Files\ISession2D-headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\OCC_StereoConfigDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\DimensionDlg.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@@ -525,6 +525,22 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\OCC_StereoConfigDlg.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -747,6 +763,7 @@
<ClInclude Include="..\..\..\..\Common\ParamsFacesPage.h" />
<ClInclude Include="..\..\..\..\Common\res\OCC_Resource.h" />
<ClInclude Include="..\..\..\..\Common\ResultDialog.h" />
<ClInclude Include="..\..\..\..\Common\OCC_StereoConfigDlg.h" />
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.h" />
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveSTEPDlg.h" />
<ClInclude Include="..\..\..\..\Common\StdAfx.h" />

View File

@@ -84,6 +84,9 @@
<ClCompile Include="..\..\..\..\Common\ResultDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\OCC_StereoConfigDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -196,6 +199,9 @@
<ClInclude Include="..\..\..\..\Common\ResultDialog.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\OCC_StereoConfigDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@@ -1168,6 +1168,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\OCC_StereoConfigDlg.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.cpp"
>
@@ -1839,6 +1843,10 @@
RelativePath="..\..\..\..\Common\res\OCC_Resource.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\OCC_StereoConfigDlg.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.h"
>

View File

@@ -1169,6 +1169,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\OCC_StereoConfigDlg.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.cpp"
>
@@ -1840,6 +1844,10 @@
RelativePath="..\..\..\..\Common\res\OCC_Resource.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\OCC_StereoConfigDlg.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.h"
>

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

View File

@@ -7,7 +7,8 @@
#include <QVBoxLayout>
#include <QMenuBar>
#include <QStatusBar>
#include <QWorkspace>
#include <QMdiArea>
#include <QMdiSubWindow>
#include <QMessageBox>
#include <QApplication>
#include <QSignalMapper>
@@ -17,8 +18,8 @@
#include <stdlib.h>
static ApplicationCommonWindow* stApp;
static QWorkspace* stWs;
static ApplicationCommonWindow* stApp = 0;
static QMdiArea* stWs = 0;
ApplicationCommonWindow::ApplicationCommonWindow()
: QMainWindow( 0 ),
@@ -38,7 +39,7 @@ myStdToolBar( 0 )
layout->setMargin( 0 );
vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
stWs = new QWorkspace( vb );
stWs = new QMdiArea( vb );
layout->addWidget( stWs );
setCentralWidget( vb );
@@ -122,7 +123,7 @@ void ApplicationCommonWindow::createStandardOperations()
QMenu* aPrefMenu = new QMenu( QObject::tr("MNU_PREFERENCES") );
aPrefMenu->addAction( filePrefUseVBOAction );
// popuplate a menu with all actions
// populate a menu with all actions
myFilePopup = new QMenu( this );
myFilePopup = menuBar()->addMenu( QObject::tr("MNU_FILE") );
myFilePopup->addAction( fileNewAction );
@@ -198,43 +199,9 @@ void ApplicationCommonWindow::createCasCadeOperations()
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_DEL") ), QObject::tr("MNU_TOOL_DEL"), this );
a->setToolTip( QObject::tr("TBR_TOOL_DEL") );
a->setStatusTip( QObject::tr("TBR_TOOL_DEL") );
connect( a, SIGNAL( activated() ) , this, SLOT( onToolAction() ) );
connect( a, SIGNAL( triggered() ) , this, SLOT( onToolAction() ) );
myToolActions.insert( ToolDeleteId, a );
#ifdef HAVE_OPENCL
// populate a tool bar with some actions
myRaytraceBar = addToolBar( tr( "Ray-trace options" ) );
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_SHADOWS") ), QObject::tr("MNU_TOOL_SHADOWS"), this );
a->setToolTip( QObject::tr("TBR_TOOL_SHADOWS") );
a->setStatusTip( QObject::tr("TBR_TOOL_SHADOWS") );
a->setCheckable( true );
a->setChecked( true );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions.insert( ToolShadowsId, a );
myRaytraceBar->addAction( a );
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_REFLECTIONS") ), QObject::tr("MNU_TOOL_REFLECTIONS"), this );
a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
a->setCheckable( true );
a->setChecked( true );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions.insert( ToolReflectionsId, a );
myRaytraceBar->addAction( a );
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_ANTIALIASING") ), QObject::tr("MNU_TOOL_ANTIALIASING"), this );
a->setToolTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
a->setStatusTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
a->setCheckable( true );
a->setChecked( false );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions.insert( ToolAntialiasingId, a );
myRaytraceBar->addAction( a );
#endif
QSignalMapper* sm = new QSignalMapper( this );
connect( sm, SIGNAL( mapped( int ) ), this, SLOT( onSetMaterial( int ) ) );
@@ -326,22 +293,12 @@ void ApplicationCommonWindow::windowsMenuAboutToShow()
QString dir = getResourceDir() + QString( "/" );
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D_GL" ), this );
a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D_GL" ) );
a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D_GL" ) );
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D" ), this );
a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D" ) );
a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D" ) );
connect( a, SIGNAL( triggered() ), this, SLOT( onCreateNewView() ) );
myWindowPopup->addAction( a );
#ifdef HAVE_OPENCL
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_NEW3D" ) ), QObject::tr( "MNU_WINDOW_NEW3D_RT" ), this );
a->setToolTip( QObject::tr( "TBR_WINDOW_NEW3D_RT" ) );
a->setStatusTip( QObject::tr( "TBR_WINDOW_NEW3D_RT" ) );
connect( a, SIGNAL( activated() ), this, SLOT( onCreateNewViewRT() ) );
myWindowPopup->addAction( a );
#endif
a = new QAction( QPixmap( dir + QObject::tr( "ICON_WINDOW_CASCADE" ) ), QObject::tr( "MNU_WINDOW_CASCADE" ), this );
a->setToolTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
a->setStatusTip( QObject::tr( "TBR_WINDOW_CASCADE" ) );
@@ -355,16 +312,15 @@ void ApplicationCommonWindow::windowsMenuAboutToShow()
myWindowPopup->addAction( a );
myWindowPopup->addSeparator();
QWidgetList windows = stWs->windowList();
for ( uint i = 0; i < windows.count(); ++i )
QList<QMdiSubWindow *> windows = stWs->subWindowList();
for (int i = 0; i < windows.count(); ++i)
{
QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
QAction* aAction = new QAction( windows.at(i)->windowTitle(), this );
aAction->setCheckable( true );
aAction->setData( i );
myWindowPopup->addAction( aAction );
connect( aAction, SIGNAL( toggled( bool ) ), this, SLOT( windowsMenuActivated( bool ) ) );
aAction->setChecked( stWs->activeWindow() == windows.at(i) );
aAction->setChecked( stWs->activeSubWindow() == windows.at(i) );
}
}
@@ -373,12 +329,12 @@ void ApplicationCommonWindow::windowsMenuActivated( bool checked )
QAction* aSender = qobject_cast<QAction*>( sender() );
if ( !aSender )
return;
QWidget* w = stWs->windowList().at( aSender->data().toInt() );
QWidget * w = stWs->subWindowList().at( aSender->data().toInt() );
if ( w && checked )
w->setFocus();
}
QWorkspace * ApplicationCommonWindow::getWorkspace()
QMdiArea * ApplicationCommonWindow::getWorkspace()
{
return stWs;
}
@@ -390,7 +346,7 @@ ApplicationCommonWindow* ApplicationCommonWindow::getApplication()
void ApplicationCommonWindow::updateFileActions()
{
if ( stWs->windowList().isEmpty() )
if ( myDocuments.isEmpty() )
{
if ( !myIsDocuments )
{
@@ -447,67 +403,49 @@ int& ApplicationCommonWindow::getNbDocument()
DocumentCommon* ApplicationCommonWindow::onNewDoc()
{
updateFileActions();
DocumentCommon* aDoc = createNewDocument();
aDoc->onCreateNewView();
onSelectionChanged();
connect( aDoc, SIGNAL( sendCloseDocument( DocumentCommon* ) ),
this, SLOT( onCloseDocument( DocumentCommon* ) ) );
connect( stWs, SIGNAL( windowActivated( QWidget* ) ),
this, SLOT( onWindowActivated( QWidget* ) ) );
connect( aDoc, SIGNAL( selectionChanged() ),
this, SLOT( onSelectionChanged() ) );
myDocuments.append( aDoc );
myStdActions.at( FileCloseId )->setEnabled( myDocuments.count() > 0 );
return aDoc;
}
DocumentCommon* ApplicationCommonWindow::onNewDocRT()
{
updateFileActions();
DocumentCommon* aDoc = createNewDocument();
aDoc->onCreateNewView(true);
onSelectionChanged();
connect( aDoc, SIGNAL( sendCloseDocument( DocumentCommon* ) ),
this, SLOT( onCloseDocument( DocumentCommon* ) ) );
connect( stWs, SIGNAL( windowActivated( QWidget* ) ),
this, SLOT( onWindowActivated( QWidget* ) ) );
connect( aDoc, SIGNAL( selectionChanged() ),
this, SLOT( onSelectionChanged() ) );
myDocuments.append( aDoc );
myStdActions.at( FileCloseId )->setEnabled( myDocuments.count() > 0 );
return aDoc;
updateFileActions();
DocumentCommon* aDoc = createNewDocument();
aDoc->onCreateNewView();
onSelectionChanged();
connect (aDoc, SIGNAL (sendCloseDocument (DocumentCommon*) ),
this, SLOT (onCloseDocument (DocumentCommon*)));
connect (stWs, SIGNAL (windowActivated (QWidget*)),
this, SLOT (onWindowActivated (QWidget*)));
connect (aDoc, SIGNAL (selectionChanged()),
this, SLOT (onSelectionChanged()));
myDocuments.append (aDoc);
myStdActions.at (FileCloseId)->setEnabled (myDocuments.count() > 0);
return aDoc;
}
void ApplicationCommonWindow::onCloseWindow()
{
MDIWindow* m = (MDIWindow*)stWs->activeWindow();
if ( m )
{
DocumentCommon* doc = m->getDocument();
onCloseDocument( doc );
}
stWs->activeSubWindow()->close();
}
void ApplicationCommonWindow::onUseVBO()
{
MDIWindow* w = ( MDIWindow* ) stWs->activeWindow();
MDIWindow* aWindow = qobject_cast<MDIWindow*> (stWs->activeSubWindow()->widget());
if ( NULL == w )
return;
if (NULL == aWindow)
return;
Handle(AIS_InteractiveContext) aContextAIS = w->getDocument()->getContext();
Handle(AIS_InteractiveContext) aContextAIS = aWindow->getDocument()->getContext();
if (aContextAIS.IsNull())
return;
if (aContextAIS.IsNull())
return;
Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
if (!aDriver.IsNull())
{
aDriver->ChangeOptions().vboDisable = Standard_True;
}
if (!aDriver.IsNull())
{
aDriver->ChangeOptions().vboDisable = Standard_True;
}
}
void ApplicationCommonWindow::onCloseDocument(DocumentCommon* theDoc)
@@ -549,20 +487,10 @@ void ApplicationCommonWindow::onAbout()
void ApplicationCommonWindow::onCreateNewView()
{
MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeWindow() );
window->getDocument()->onCreateNewView( false );
MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeSubWindow()->widget() );
window->getDocument()->onCreateNewView();
}
#ifdef HAVE_OPENCL
void ApplicationCommonWindow::onCreateNewViewRT()
{
MDIWindow* window = qobject_cast< MDIWindow* >( stWs->activeWindow() );
window->getDocument()->onCreateNewView( true );
}
#endif
void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
{
if (w == NULL)
@@ -573,21 +501,13 @@ void ApplicationCommonWindow::onWindowActivated ( QWidget * w )
MDIWindow* window = qobject_cast< MDIWindow* >(w);
window->onWindowActivated();
#ifdef HAVE_OPENCL
myRaytraceActions.at( ToolShadowsId )->setChecked (window->ShadowsEnabled());
myRaytraceActions.at( ToolReflectionsId )->setChecked (window->ReflectionsEnabled());
myRaytraceActions.at( ToolAntialiasingId )->setChecked (window->AntialiasingEnabled());
#endif
}
void ApplicationCommonWindow::onToolAction()
{
QAction* sentBy = (QAction*) sender();
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
if( sentBy == myToolActions.at( ToolWireframeId ) )
doc->onWireframe();
@@ -608,87 +528,60 @@ void ApplicationCommonWindow::onToolAction()
doc->onDelete();
}
#ifdef HAVE_OPENCL
void ApplicationCommonWindow::onRaytraceAction()
{
QAction* sentBy = (QAction*) sender();
DocumentCommon* doc = qobject_cast< MDIWindow* >(
ApplicationCommonWindow::getWorkspace()->activeWindow())->getDocument();
if( sentBy == myRaytraceActions.at( ToolShadowsId ) )
{
bool flag = myRaytraceActions.at( ToolShadowsId )->isChecked();
doc->onShadows( flag );
}
if( sentBy == myRaytraceActions.at( ToolReflectionsId ) )
{
bool flag = myRaytraceActions.at( ToolReflectionsId )->isChecked();
doc->onReflections( flag );
}
if( sentBy == myRaytraceActions.at( ToolAntialiasingId ) )
{
bool flag = myRaytraceActions.at( ToolAntialiasingId )->isChecked();
doc->onAntialiasing( flag );
}
}
#endif
void ApplicationCommonWindow::onSelectionChanged()
{
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
DocumentCommon* doc;
if( !qobject_cast<MDIWindow*>( ws->activeWindow() ) )
if( !qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )
return;
doc = ((MDIWindow*)ws->activeWindow())->getDocument();
Handle(AIS_InteractiveContext) context = doc->getContext();
doc = ( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() ) )->getDocument();
Handle(AIS_InteractiveContext) context = doc->getContext();
bool OneOrMoreInShading = false;
bool OneOrMoreInWireframe = false;
int numSel = context->NbSelected();
if ( numSel )
bool OneOrMoreInShading = false;
bool OneOrMoreInWireframe = false;
int numSel = context->NbSelected();
if ( numSel )
{
for ( context->InitCurrent(); context->MoreCurrent(); context->NextCurrent() )
{
for ( context->InitCurrent(); context->MoreCurrent(); context->NextCurrent() )
{
if ( context->IsDisplayed( context->Current(), 1 ) )
OneOrMoreInShading = true;
if ( context->IsDisplayed( context->Current(), 0 ) )
OneOrMoreInWireframe = true;
}
myToolActions.at( ToolWireframeId )->setEnabled( OneOrMoreInShading );
myToolActions.at( ToolShadingId )->setEnabled( OneOrMoreInWireframe );
myToolActions.at( ToolColorId )->setEnabled( true );
myToolActions.at( ToolMaterialId )->setEnabled( true );
myToolActions.at( ToolTransparencyId )->setEnabled( OneOrMoreInShading );
myToolActions.at( ToolDeleteId )->setEnabled( true );
}
else
{
myToolActions.at( ToolWireframeId )->setEnabled( false );
myToolActions.at( ToolShadingId )->setEnabled( false );
myToolActions.at( ToolColorId )->setEnabled( false );
myToolActions.at( ToolMaterialId )->setEnabled( false );
myToolActions.at( ToolTransparencyId )->setEnabled( false );
myToolActions.at( ToolDeleteId )->setEnabled( false );
if ( context->IsDisplayed( context->Current(), 1 ) )
OneOrMoreInShading = true;
if ( context->IsDisplayed( context->Current(), 0 ) )
OneOrMoreInWireframe = true;
}
myToolActions.at( ToolWireframeId )->setEnabled( OneOrMoreInShading );
myToolActions.at( ToolShadingId )->setEnabled( OneOrMoreInWireframe );
myToolActions.at( ToolColorId )->setEnabled( true );
myToolActions.at( ToolMaterialId )->setEnabled( true );
myToolActions.at( ToolTransparencyId )->setEnabled( OneOrMoreInShading );
myToolActions.at( ToolDeleteId )->setEnabled( true );
}
else
{
myToolActions.at( ToolWireframeId )->setEnabled( false );
myToolActions.at( ToolShadingId )->setEnabled( false );
myToolActions.at( ToolColorId )->setEnabled( false );
myToolActions.at( ToolMaterialId )->setEnabled( false );
myToolActions.at( ToolTransparencyId )->setEnabled( false );
myToolActions.at( ToolDeleteId )->setEnabled( false );
}
}
void ApplicationCommonWindow::onSetMaterial( int theMaterial )
{
QWorkspace* ws = getWorkspace();
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
QMdiArea* ws = getWorkspace();
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
doc->onMaterial( theMaterial );
}
QString ApplicationCommonWindow::getResourceDir()
{
static QString resDir( ::getenv( "CSF_ResourcesDefaults" ) );
return resDir;
static QString aResourceDir =
QString::fromUtf8 (qgetenv ("CSF_ResourcesDefaults").constData());
return aResourceDir;
}
void ApplicationCommonWindow::resizeEvent( QResizeEvent* e )

View File

@@ -7,7 +7,7 @@
#include <QAction>
#include <QToolBar>
#include <QMenu>
#include <QWorkspace>
#include <QMdiArea>
#include <QList>
@@ -18,12 +18,11 @@ class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
public:
enum { FileNewId, FilePrefUseVBOId, FileCloseId, FilePreferencesId, FileQuitId, ViewToolId, ViewStatusId, HelpAboutId };
enum { ToolWireframeId, ToolShadingId, ToolColorId, ToolMaterialId, ToolTransparencyId, ToolDeleteId };
enum { ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
ApplicationCommonWindow();
~ApplicationCommonWindow();
static QWorkspace* getWorkspace();
static QMdiArea* getWorkspace();
static ApplicationCommonWindow* getApplication();
static QString getResourceDir();
@@ -38,7 +37,6 @@ protected:
public slots:
DocumentCommon* onNewDoc();
DocumentCommon* onNewDocRT();
void onCloseWindow();
void onUseVBO();
virtual void onCloseDocument( DocumentCommon* theDoc );
@@ -47,13 +45,7 @@ public slots:
void onViewToolBar();
void onViewStatusBar();
void onToolAction();
#ifdef HAVE_OPENCL
void onRaytraceAction();
#endif
void onCreateNewView();
#ifdef HAVE_OPENCL
void onCreateNewViewRT();
#endif
void onWindowActivated ( QWidget * w );
void windowsMenuAboutToShow();
void windowsMenuActivated( bool checked/*int id*/ );
@@ -77,16 +69,17 @@ private:
QList<QAction*> myStdActions;
QList<QAction*> myToolActions;
QList<QAction*> myRaytraceActions;
QList<QAction*> myMaterialActions;
QList<DocumentCommon*> myDocuments;
//QList<DocumentCommon*> myDocuments;
QToolBar* myStdToolBar;
QToolBar* myCasCadeBar;
QToolBar* myRaytraceBar;
QMenu* myFilePopup;
QMenu* myWindowPopup;
QAction* myFileSeparator;
protected:
QList<DocumentCommon*> myDocuments;
};
#endif

View File

@@ -86,14 +86,6 @@
<source>ICON_NEW</source>
<translation>new.png</translation>
</message>
<message>
<source>ICON_NEW_GL</source>
<translation>newGL.png</translation>
</message>
<message>
<source>ICON_NEW_RT</source>
<translation>newRT.png</translation>
</message>
<message>
<source>ICON_VIEW_RIGHT</source>
<translation>view_right.png</translation>
@@ -134,10 +126,18 @@
<source>ICON_SAMPLE</source>
<translation>lamp.png</translation>
</message>
<message>
<source>ICON_TOOL_RAYTRACING</source>
<translation>raytracing.png</translation>
</message>
<message>
<source>ICON_TOOL_SHADOWS</source>
<translation>shadows.png</translation>
</message>
<message>
<source>ICON_TOOL_RAYTRACING</source>
<translation>shadows.png</translation>
</message>
<message>
<source>ICON_TOOL_REFLECTIONS</source>
<translation>reflections.png</translation>

View File

@@ -142,13 +142,17 @@
<source>MNU_TOOL_SHADOWS</source>
<translation>&amp;Shadows</translation>
</message>
<message>
<source>MNU_TOOL_RAYTRACING</source>
<translation>&amp;Ray-tracing</translation>
</message>
<message>
<source>MNU_TOOL_REFLECTIONS</source>
<translation>&amp;Reflections</translation>
</message>
<message>
<source>MNU_TOOL_ANTIALIASING</source>
<translation>&amp;Antialiasing</translation>
<translation>&amp;Anti-aliasing</translation>
</message>
<message>
<source>BTN_BRASS</source>
@@ -270,6 +274,22 @@
<source>TBR_TOOL_MATER</source>
<translation>Material</translation>
</message>
<message>
<source>TBR_TOOL_RAYTRACING</source>
<translation>Enable Ray-tracing</translation>
</message>
<message>
<source>TBR_TOOL_SHADOWS</source>
<translation>Enable Shadows</translation>
</message>
<message>
<source>TBR_TOOL_REFLECTIONS</source>
<translation>Enable Reflections</translation>
</message>
<message>
<source>TBR_TOOL_ANTIALIASING</source>
<translation>Enable Anti-aliasing</translation>
</message>
<message>
<source>TBR_TOOL_BAR</source>
<translation>Toolbar</translation>
@@ -343,20 +363,8 @@
<translation>New 3D View</translation>
</message>
<message>
<source>TBR_WINDOW_NEW3D_GL</source>
<translation>New GL 3D View</translation>
</message>
<message>
<source>MNU_WINDOW_NEW3D_GL</source>
<translation>New GL 3D View</translation>
</message>
<message>
<source>TBR_WINDOW_NEW3D_RT</source>
<translation>&amp;New RT 3D View</translation>
</message>
<message>
<source>MNU_WINDOW_NEW3D_RT</source>
<translation>&amp;New RT 3D View</translation>
<source>MNU_WINDOW_NEW3D</source>
<translation>New 3D View</translation>
</message>
<message>
<source>MNU_STATUS_BAR</source>

View File

@@ -16,13 +16,16 @@
#include <OpenGl_GraphicDriver.hxx>
#include <TCollection_AsciiString.hxx>
Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString aDisplay,
const Standard_ExtString aName,
const Standard_CString aDomain,
const Standard_Real ViewSize,
const V3d_TypeOfOrientation ViewProj,
const Standard_Boolean ComputedMode,
const Standard_Boolean aDefaultComputedMode )
// =======================================================================
// function : Viewer
// purpose :
// =======================================================================
Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString theName,
const Standard_CString theDomain,
const Standard_Real theViewSize,
const V3d_TypeOfOrientation theViewProj,
const Standard_Boolean theComputedMode,
const Standard_Boolean theDefaultComputedMode )
{
static Handle(OpenGl_GraphicDriver) aGraphicDriver;
@@ -30,14 +33,23 @@ Handle(V3d_Viewer) DocumentCommon::Viewer( const Standard_CString aDisplay,
{
Handle(Aspect_DisplayConnection) aDisplayConnection;
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
aDisplayConnection = new Aspect_DisplayConnection (aDisplay);
aDisplayConnection = new Aspect_DisplayConnection (qgetenv ("DISPLAY").constData());
#endif
aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection);
}
return new V3d_Viewer(aGraphicDriver,aName,aDomain,ViewSize,ViewProj,
Quantity_NOC_GRAY30,V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
ComputedMode,aDefaultComputedMode,V3d_TEX_NONE);
return new V3d_Viewer (aGraphicDriver,
theName,
theDomain,
theViewSize,
theViewProj,
Quantity_NOC_GRAY30,
V3d_ZBUFFER,
V3d_GOURAUD,
V3d_WAIT,
theComputedMode,
theDefaultComputedMode,
V3d_TEX_NONE);
}
DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app )
@@ -46,14 +58,14 @@ myApp( app ),
myIndex( theIndex ),
myNbViews( 0 )
{
TCollection_ExtendedString a3DName("Visu3D");
myViewer = Viewer( getenv("DISPLAY"), a3DName.ToExtString(), "", 1000.0,
V3d_XposYnegZpos, Standard_True, Standard_True );
TCollection_ExtendedString a3DName ("Visu3D");
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myViewer = Viewer (a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Standard_True, Standard_True);
myContext =new AIS_InteractiveContext(myViewer);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myContext = new AIS_InteractiveContext (myViewer);
}
DocumentCommon::~DocumentCommon()
@@ -65,22 +77,22 @@ ApplicationCommonWindow* DocumentCommon::getApplication()
return myApp;
}
MDIWindow* DocumentCommon::createNewMDIWindow( bool theRT )
MDIWindow* DocumentCommon::createNewMDIWindow()
{
QWorkspace* ws = myApp->getWorkspace();
return new MDIWindow( this, ws, 0, theRT );
QMdiArea* ws = myApp->getWorkspace();
return new MDIWindow (this, ws, 0);
}
void DocumentCommon::onCreateNewView( bool theRT )
void DocumentCommon::onCreateNewView()
{
QWorkspace* ws = myApp->getWorkspace();
MDIWindow* w = createNewMDIWindow( theRT );
QMdiArea* ws = myApp->getWorkspace();
MDIWindow* w = createNewMDIWindow();
if( !w )
if (!w)
return;
ws->addWindow( w );
myViews.append(w);
ws->addSubWindow (w);
myViews.append (w);
connect( w, SIGNAL( selectionChanged() ),
this, SIGNAL( selectionChanged() ) );
@@ -95,7 +107,7 @@ void DocumentCommon::onCreateNewView( bool theRT )
w->setWindowIcon( QPixmap( dir + QObject::tr("ICON_DOC") ) );
if ( ws->windowList().isEmpty() )
if ( ws->subWindowList().isEmpty() )
{
// Due to strange Qt4.2.3 feature the child window icon is not drawn
// in the main menu if showMaximized() is called for a non-visible child window
@@ -129,7 +141,9 @@ void DocumentCommon::removeView(MDIWindow* theView)
void DocumentCommon::removeViews()
{
while( myViews.count() )
removeView( (MDIWindow*)myViews.first() );
{
removeView( myViews.first() );
}
}
int DocumentCommon::countOfWindow()
@@ -226,49 +240,3 @@ void DocumentCommon::onDelete()
myContext->ClearSelected();
getApplication()->onSelectionChanged();
}
#ifdef HAVE_OPENCL
void DocumentCommon::onShadows( int state )
{
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
if( window == NULL )
return;
window->setRaytracedShadows( state );
myContext->UpdateCurrentViewer();
}
void DocumentCommon::onReflections( int state )
{
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
if( window == NULL )
return;
window->setRaytracedReflections( state );
myContext->UpdateCurrentViewer();
}
void DocumentCommon::onAntialiasing( int state )
{
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
MDIWindow* window = qobject_cast< MDIWindow* >( ws->activeWindow() );
if( window == NULL )
return;
window->setRaytracedAntialiasing( state );
myContext->UpdateCurrentViewer();
}
#endif

View File

@@ -28,7 +28,7 @@ public:
void fitAll();
protected:
virtual MDIWindow* createNewMDIWindow( bool theRT = false );
virtual MDIWindow* createNewMDIWindow();
signals:
void selectionChanged();
@@ -36,17 +36,11 @@ signals:
public slots:
virtual void onCloseView( MDIWindow* );
virtual void onCreateNewView( bool theRT = false );
virtual void onCreateNewView();
virtual void onMaterial();
virtual void onMaterial( int );
virtual void onDelete();
#ifdef HAVE_OPENCL
virtual void onShadows( int state );
virtual void onReflections( int state );
virtual void onAntialiasing( int state );
#endif
void onWireframe();
void onShading();
void onColor();
@@ -54,13 +48,12 @@ public slots:
void onTransparency( int );
private:
Handle(V3d_Viewer) Viewer( const Standard_CString aDisplay,
const Standard_ExtString aName,
const Standard_CString aDomain,
const Standard_Real ViewSize,
const V3d_TypeOfOrientation ViewProj,
const Standard_Boolean ComputedMode,
const Standard_Boolean aDefaultComputedMode );
Handle(V3d_Viewer) Viewer (const Standard_ExtString theName,
const Standard_CString theDomain,
const Standard_Real theViewSize,
const V3d_TypeOfOrientation theViewProj,
const Standard_Boolean theComputedMode,
const Standard_Boolean theDefaultComputedMode );
protected:
ApplicationCommonWindow* myApp;

View File

@@ -21,20 +21,11 @@ MDIWindow::MDIWindow(View* aView,
Qt::WindowFlags wflags )
: QMainWindow( parent, wflags )
{
myView = aView;
myDocument = aDocument;
#ifdef HAVE_OPENCL
myShadowsEnabled = true;
myReflectionsEnabled = true;
myAntialiasingEnabled = false;
#endif
}
MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags, bool theRT )
MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags)
: QMainWindow( parent, wflags )
{
QFrame *vb = new QFrame( this );
@@ -47,24 +38,18 @@ MDIWindow::MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlag
setCentralWidget( vb );
myDocument = aDocument;
myView = new View( myDocument->getContext(), vb, theRT );
layout->addWidget( myView );
myView = new View (myDocument->getContext(), vb);
layout->addWidget (myView);
connect( myView, SIGNAL( selectionChanged() ),
this, SIGNAL( selectionChanged() ) );
createViewActions();
createViewActions();
createRaytraceActions();
resize( sizeHint() );
setFocusPolicy( Qt::StrongFocus );
#ifdef HAVE_OPENCL
myShadowsEnabled = true;
myReflectionsEnabled = true;
myAntialiasingEnabled = false;
#endif
}
MDIWindow::~MDIWindow()
@@ -98,21 +83,34 @@ void MDIWindow::createViewActions()
aList->at(View::ViewHlrOffId)->setChecked( true );
}
void MDIWindow::createRaytraceActions()
{
// populate a tool bar with some actions
QToolBar* aToolBar = addToolBar( tr( "Ray-tracing Options" ) );
QList<QAction*>* aList = myView->getRaytraceActions();
aToolBar->addActions( *aList );
aToolBar->toggleViewAction()->setVisible (true);
aList->at (View::ToolRaytracingId)->setChecked (false);
aList->at (View::ToolShadowsId)->setChecked (true);
aList->at (View::ToolReflectionsId)->setChecked (true);
aList->at (View::ToolAntialiasingId)->setChecked (false);
}
void MDIWindow::onWindowActivated ()
{
getDocument()->getApplication()->onSelectionChanged();
}
void MDIWindow::dump()
{
QString datadir = (QString(getenv("CASROOT")) + "/../data/images");
QString datadir = (QString(qgetenv ("CASROOT").constData()) + "/../data/images");
static QString filter;
filter = "Images Files (*.bmp *.ppm *.png *.jpg *.tiff *.tga *.gif *.exr *.ps *.eps *.tex *.pdf *.svg *.pgf)";
QFileDialog fd ( 0 );
fd.setModal( true );
fd.setFilter( filter );
fd.setNameFilter ( filter );
fd.setWindowTitle( QObject::tr("INF_APP_EXPORT") );
fd.setFileMode( QFileDialog::AnyFile );
int ret = fd.exec();
@@ -129,6 +127,7 @@ void MDIWindow::dump()
QApplication::setOverrideCursor( Qt::WaitCursor );
if ( !QFileInfo( file ).completeSuffix().length() )
file += QString( ".bmp" );
bool res = myView->dump( (Standard_CString)file.toLatin1().constData() );
QApplication::restoreOverrideCursor();
if ( !res )
@@ -152,27 +151,3 @@ QSize MDIWindow::sizeHint() const
{
return QSize( 450, 300 );
}
#ifdef HAVE_OPENCL
void MDIWindow::setRaytracedShadows( int state )
{
myView->setRaytracedShadows( state );
myShadowsEnabled = state;
}
void MDIWindow::setRaytracedReflections( int state )
{
myView->setRaytracedReflections( state );
myReflectionsEnabled = state;
}
void MDIWindow::setRaytracedAntialiasing( int state )
{
myView->setRaytracedAntialiasing( state );
myAntialiasingEnabled = state;
}
#endif

View File

@@ -12,7 +12,7 @@ class COMMONSAMPLE_EXPORT MDIWindow: public QMainWindow
Q_OBJECT
public:
MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags, bool theRT = false );
MDIWindow( DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
MDIWindow( View* aView, DocumentCommon* aDocument, QWidget* parent, Qt::WindowFlags wflags );
~MDIWindow();
@@ -20,18 +20,6 @@ public:
void fitAll();
virtual QSize sizeHint() const;
#ifdef HAVE_OPENCL
void setRaytracedShadows( int state );
void setRaytracedReflections( int state );
void setRaytracedAntialiasing( int state );
bool ShadowsEnabled() { return myShadowsEnabled; }
bool ReflectionsEnabled() { return myReflectionsEnabled; }
bool AntialiasingEnabled() { return myAntialiasingEnabled; }
#endif
signals:
void selectionChanged();
void message(const QString&, int );
@@ -44,19 +32,11 @@ public slots:
protected:
void createViewActions();
void createRaytraceActions();
protected:
DocumentCommon* myDocument;
View* myView;
#ifdef HAVE_OPENCL
bool myShadowsEnabled;
bool myReflectionsEnabled;
bool myAntialiasingEnabled;
#endif
};
#endif
#endif

View File

@@ -14,12 +14,13 @@
#include <QFileDialog>
#include <QMouseEvent>
#include <QRubberBand>
#include <QMdiSubWindow>
#include <QStyleFactory>
#include <Visual3d_View.hxx>
#include <Graphic3d_ExportFormat.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_TextureEnv.hxx>
#include <QWindowsStyle>
#if defined(_WIN32) || defined(__WIN32__)
#include <WNT_Window.hxx>
@@ -54,10 +55,14 @@ static QCursor* globPanCursor = NULL;
static QCursor* zoomCursor = NULL;
static QCursor* rotCursor = NULL;
View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent, bool theRT )
View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
: QWidget( parent ),
myIsRT( theRT ),
myIsRaytracing( false ),
myIsShadowsEnabled (true),
myIsReflectionsEnabled (true),
myIsAntialiasingEnabled (false),
myViewActions( 0 ),
myRaytraceActions( 0 ),
myBackMenu( NULL )
{
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
@@ -77,7 +82,7 @@ myBackMenu( NULL )
myCurZoom = 0;
myRectBand = 0;
setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_NoSystemBackground);
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
@@ -153,7 +158,12 @@ myBackMenu( NULL )
myCurrentMode = CurAction3d_Nothing;
myHlrModeIsOn = Standard_False;
setMouseTracking( true );
if( myFirst )
{
init();
myFirst = false;
}
initViewActions();
initCursors();
@@ -172,8 +182,9 @@ View::~View()
void View::init()
{
if (myView.IsNull())
myView = myContext->CurrentViewer()->CreateView();
if ( myView.IsNull() )
myView = myContext->CurrentViewer()->CreateView();
#if defined(_WIN32) || defined(__WIN32__)
Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
Handle(WNT_Window) hWnd = new WNT_Window (aWindowHandle);
@@ -185,15 +196,16 @@ void View::init()
Handle(Aspect_DisplayConnection) aDispConnection = myContext->CurrentViewer()->Driver()->GetDisplayConnection();
Handle(Xw_Window) hWnd = new Xw_Window (aDispConnection, aWindowHandle);
#endif // WNT
myView->SetWindow (hWnd);
if (!hWnd->IsMapped())
if ( !hWnd->IsMapped() )
{
hWnd->Map();
}
myView->SetBackgroundColor (Quantity_NOC_BLACK);
myView->MustBeResized();
if (myIsRT)
if (myIsRaytracing)
myView->SetRaytracingMode();
}
@@ -310,28 +322,95 @@ void View::hlrOn()
QApplication::restoreOverrideCursor();
}
void View::setRaytracedShadows( int state )
void View::SetRaytracedShadows (bool theState)
{
if ( state )
if (theState)
myView->EnableRaytracedShadows();
else
myView->DisableRaytracedShadows();
myIsShadowsEnabled = theState;
myContext->UpdateCurrentViewer();
}
void View::setRaytracedReflections( int state )
void View::SetRaytracedReflections (bool theState)
{
if ( state )
if (theState)
myView->EnableRaytracedReflections();
else
myView->DisableRaytracedReflections();
myIsReflectionsEnabled = theState;
myContext->UpdateCurrentViewer();
}
void View::setRaytracedAntialiasing( int state )
void View::onRaytraceAction()
{
if ( state )
QAction* aSentBy = (QAction*)sender();
if (aSentBy == myRaytraceActions->at (ToolRaytracingId))
{
bool aState = myRaytraceActions->at (ToolRaytracingId)->isChecked();
QApplication::setOverrideCursor (Qt::WaitCursor);
if (aState)
EnableRaytracing();
else
DisableRaytracing();
QApplication::restoreOverrideCursor();
}
if (aSentBy == myRaytraceActions->at (ToolShadowsId))
{
bool aState = myRaytraceActions->at (ToolShadowsId)->isChecked();
SetRaytracedShadows (aState);
}
if (aSentBy == myRaytraceActions->at (ToolReflectionsId))
{
bool aState = myRaytraceActions->at (ToolReflectionsId)->isChecked();
SetRaytracedReflections (aState);
}
if (aSentBy == myRaytraceActions->at (ToolAntialiasingId))
{
bool aState = myRaytraceActions->at (ToolAntialiasingId)->isChecked();
SetRaytracedAntialiasing (aState);
}
}
void View::SetRaytracedAntialiasing (bool theState)
{
if (theState)
myView->EnableRaytracedAntialiasing();
else
myView->DisableRaytracedAntialiasing();
myIsAntialiasingEnabled = theState;
myContext->UpdateCurrentViewer();
}
void View::EnableRaytracing()
{
if (!myIsRaytracing)
myView->SetRaytracingMode();
myIsRaytracing = true;
myContext->UpdateCurrentViewer();
}
void View::DisableRaytracing()
{
if (myIsRaytracing)
myView->SetRasterizationMode();
myIsRaytracing = false;
myContext->UpdateCurrentViewer();
}
void View::updateToggled( bool isOn )
@@ -398,6 +477,12 @@ QList<QAction*>* View::getViewActions()
return myViewActions;
}
QList<QAction*>* View::getRaytraceActions()
{
initRaytraceActions();
return myRaytraceActions;
}
/*!
Get paint engine for the OpenGL viewer. [ virtual public ]
*/
@@ -533,6 +618,48 @@ void View::initViewActions()
myViewActions->insert( ViewHlrOnId, a );
}
void View::initRaytraceActions()
{
if ( myRaytraceActions )
return;
myRaytraceActions = new QList<QAction*>();
QString dir = ApplicationCommonWindow::getResourceDir() + QString( "/" );
QAction* a;
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_RAYTRACING") ), QObject::tr("MNU_TOOL_RAYTRACING"), this );
a->setToolTip( QObject::tr("TBR_TOOL_RAYTRACING") );
a->setStatusTip( QObject::tr("TBR_TOOL_RAYTRACING") );
a->setCheckable( true );
a->setChecked( false );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions->insert( ToolRaytracingId, a );
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_SHADOWS") ), QObject::tr("MNU_TOOL_SHADOWS"), this );
a->setToolTip( QObject::tr("TBR_TOOL_SHADOWS") );
a->setStatusTip( QObject::tr("TBR_TOOL_SHADOWS") );
a->setCheckable( true );
a->setChecked( true );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions->insert( ToolShadowsId, a );
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_REFLECTIONS") ), QObject::tr("MNU_TOOL_REFLECTIONS"), this );
a->setToolTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
a->setStatusTip( QObject::tr("TBR_TOOL_REFLECTIONS") );
a->setCheckable( true );
a->setChecked( true );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions->insert( ToolReflectionsId, a );
a = new QAction( QPixmap( dir+QObject::tr("ICON_TOOL_ANTIALIASING") ), QObject::tr("MNU_TOOL_ANTIALIASING"), this );
a->setToolTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
a->setStatusTip( QObject::tr("TBR_TOOL_ANTIALIASING") );
a->setCheckable( true );
a->setChecked( false );
connect( a, SIGNAL( activated() ) , this, SLOT( onRaytraceAction() ) );
myRaytraceActions->insert( ToolAntialiasingId, a );
}
void View::mousePressEvent( QMouseEvent* e )
{
if ( e->button() == Qt::LeftButton )
@@ -855,8 +982,8 @@ void View::MultiInputEvent( const int /*x*/, const int /*y*/ )
void View::Popup( const int /*x*/, const int /*y*/ )
{
ApplicationCommonWindow* stApp = ApplicationCommonWindow::getApplication();
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
QWidget* w = ws->activeWindow();
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
QMdiSubWindow* w = ws->activeSubWindow();
if ( myContext->NbSelected() )
{
QList<QAction*>* aList = stApp->getToolActions();
@@ -928,7 +1055,7 @@ void View::DrawRectangle(const int MinX, const int MinY,
if ( !myRectBand )
{
myRectBand = new QRubberBand( QRubberBand::Rectangle, this );
myRectBand->setStyle(new QWindowsStyle);
myRectBand->setStyle( QStyleFactory::create("windows") );
myRectBand->setGeometry( aRect );
myRectBand->show();
@@ -1000,7 +1127,7 @@ void View::onEnvironmentMap()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
tr("All Image Files (*.bmp *.gif *.jpg *.jpeg *.png *.tga)"));
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toAscii().data() );
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toLatin1().data() );
myView->SetTextureEnv (aTexture);
myView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT);

View File

@@ -24,22 +24,30 @@ public:
enum ViewAction { ViewFitAllId, ViewFitAreaId, ViewZoomId, ViewPanId, ViewGlobalPanId,
ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId, ViewRightId,
ViewAxoId, ViewRotationId, ViewResetId, ViewHlrOffId, ViewHlrOnId };
enum RaytraceAction { ToolRaytracingId, ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
View( Handle(AIS_InteractiveContext) theContext,
QWidget* parent,
bool theRT = false );
View( Handle(AIS_InteractiveContext) theContext, QWidget* parent );
~View();
virtual void init();
bool dump( Standard_CString theFile );
QList<QAction*>* getViewActions();
QList<QAction*>* getRaytraceActions();
void noActiveActions();
bool isShadingMode();
void setRaytracedShadows( int state );
void setRaytracedReflections( int state );
void setRaytracedAntialiasing( int state );
void EnableRaytracing();
void DisableRaytracing();
void SetRaytracedShadows (bool theState);
void SetRaytracedReflections (bool theState);
void SetRaytracedAntialiasing (bool theState);
bool IsRaytracingMode() const { return myIsRaytracing; }
bool IsShadowsEnabled() const { return myIsShadowsEnabled; }
bool IsReflectionsEnabled() const { return myIsReflectionsEnabled; }
bool IsAntialiasingEnabled() const { return myIsAntialiasingEnabled; }
static QString GetMessages( int type,TopAbs_ShapeEnum aSubShapeType,
TopAbs_ShapeEnum aShapeType );
@@ -77,6 +85,7 @@ public slots:
void updateToggled( bool );
void onBackground();
void onEnvironmentMap();
void onRaytraceAction();
protected:
virtual void paintEvent( QPaintEvent* );
@@ -104,6 +113,7 @@ protected:
private:
void initCursors();
void initViewActions();
void initRaytraceActions();
void DragEvent( const int x, const int y, const int TheState );
void InputEvent( const int x, const int y );
void MoveEvent( const int x, const int y );
@@ -114,7 +124,11 @@ private:
const int MaxX, const int MaxY, const bool Draw );
private:
bool myIsRT;
bool myIsRaytracing;
bool myIsShadowsEnabled;
bool myIsReflectionsEnabled;
bool myIsAntialiasingEnabled;
bool myFirst;
bool myDrawRect; // set when a rect is used for selection or magnify
Handle(V3d_View) myView;
@@ -127,6 +141,7 @@ private:
Quantity_Factor myCurZoom;
Standard_Boolean myHlrModeIsOn;
QList<QAction*>* myViewActions;
QList<QAction*>* myRaytraceActions;
QMenu* myBackMenu;
QRubberBand* myRectBand; //!< selection rectangle rubber band
};

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcxproj", "{7972FDD8-9612-3401-827F-C8DF8E2689B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -8,12 +8,12 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.Build.0 = Debug|Win32
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.ActiveCfg = Release|Win32
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.Build.0 = Release|Win32
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.ActiveCfg = Debug|Win32
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Debug|Win32.Build.0 = Debug|Win32
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.ActiveCfg = Release|Win32
{7972FDD8-9612-3401-827F-C8DF8E2689B5}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
EndGlobal

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IESample", "IESample.vcproj", "{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -8,10 +8,10 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Debug|Win32.Build.0 = Debug|Win32
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.ActiveCfg = Release|Win32
{7FD0453F-8AC0-3EE3-9C11-DD413EF20A44}.Release|Win32.Build.0 = Release|Win32
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Debug|Win32.ActiveCfg = Debug|Win32
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Debug|Win32.Build.0 = Debug|Win32
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Release|Win32.ActiveCfg = Release|Win32
{AD4DADCB-F15E-37FD-B3AA-88504FAAF4FD}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -3,10 +3,9 @@ CONFIG += debug_and_release qt
TARGET = IESample
SAMPLESROOT = $$(CASROOT)/samples/qt
SAMPLESROOT = $$(SAMPLESROOT)
HEADERS = src/*.h \
$${SAMPLESROOT}/Common/src/*.h \
HEADERS = $${SAMPLESROOT}/Common/src/*.h \
$${SAMPLESROOT}/Interface/src/*.h
SOURCES = src/*.cxx \
@@ -24,7 +23,9 @@ RES_DIR = $$quote($$(RES_DIR))
INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
DEFINES = CSFDB
OCCT_DEFINES = $$(CSF_DEFINES)
DEFINES = CSFDB $$split(OCCT_DEFINES, ;)
unix {
UNAME = $$system(uname -s)
@@ -38,11 +39,11 @@ unix {
CONFIG(debug, debug|release) {
DESTDIR = ./$$UNAME/bind
OBJECTS_DIR = ./$$UNAME/objd
MOC_DIR = ./$$UNAME/srcd
MOC_DIR = ./$$UNAME/mocd
} else {
DESTDIR = ./$$UNAME/bin
OBJECTS_DIR = ./$$UNAME/obj
MOC_DIR = ./$$UNAME/src
MOC_DIR = ./$$UNAME/moc
}
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
@@ -63,107 +64,23 @@ win32 {
CONFIG(debug, debug|release) {
DEFINES += _DEBUG
DESTDIR = ./win$(ARCH)/$(VCVER)/bind
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
MOC_DIR = ./win$(ARCH)/$(VCVER)/mocd
!contains(QMAKE_HOST.arch, x86_64) {
LIBS = -L$(CSF_OPT_LIB32D)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
DESTDIR = ./win32/vc7/bind
OBJECTS_DIR = ./win32/vc7/objd
MOC_DIR = ./win32/vc7/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win32/vc8/bind
OBJECTS_DIR = ./win32/vc8/objd
MOC_DIR = ./win32/vc8/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win32/vc9/bind
OBJECTS_DIR = ./win32/vc9/objd
MOC_DIR = ./win32/vc9/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win32/vc10/bind
OBJECTS_DIR = ./win32/vc10/objd
MOC_DIR = ./win32/vc10/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win32/vc11/bind
OBJECTS_DIR = ./win32/vc11/objd
MOC_DIR = ./win32/vc11/srcd
}
LIBS = -L$(CSF_OPT_LIB32D)
} else {
LIBS = -L$(CSF_OPT_LIB64D)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win64/vc8/bind
OBJECTS_DIR = ./win64/vc8/objd
MOC_DIR = ./win64/vc8/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win64/vc9/bind
OBJECTS_DIR = ./win64/vc9/objd
MOC_DIR = ./win64/vc9/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win64/vc10/bind
OBJECTS_DIR = ./win64/vc10/objd
MOC_DIR = ./win64/vc10/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win64/vc11/bind
OBJECTS_DIR = ./win64/vc11/objd
MOC_DIR = ./win64/vc11/srcd
}
LIBS = -L$(CSF_OPT_LIB64D)
}
} else {
DEFINES += NDEBUG
DESTDIR = ./win$(ARCH)/$(VCVER)/bin
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
MOC_DIR = ./win$(ARCH)/$(VCVER)/moc
!contains(QMAKE_HOST.arch, x86_64) {
LIBS = -L$(CSF_OPT_LIB32)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
DESTDIR = ./win32/vc7/bin
OBJECTS_DIR = ./win32/vc7/obj
MOC_DIR = ./win32/vc7/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win32/vc8/bin
OBJECTS_DIR = ./win32/vc8/obj
MOC_DIR = ./win32/vc8/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win32/vc9/bin
OBJECTS_DIR = ./win32/vc9/obj
MOC_DIR = ./win32/vc9/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win32/vc10/bin
OBJECTS_DIR = ./win32/vc10/obj
MOC_DIR = ./win32/vc10/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win32/vc11/bin
OBJECTS_DIR = ./win32/vc11/obj
MOC_DIR = ./win32/vc11/src
}
LIBS = -L$(CSF_OPT_LIB32)
} else {
LIBS = -L$(CSF_OPT_LIB64)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win64/vc8/bin
OBJECTS_DIR = ./win64/vc8/obj
MOC_DIR = ./win64/vc8/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win64/vc9/bin
OBJECTS_DIR = ./win64/vc9/obj
MOC_DIR = ./win64/vc9/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win64/vc10/bin
OBJECTS_DIR = ./win64/vc10/obj
MOC_DIR = ./win64/vc10/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win64/vc11/bin
OBJECTS_DIR = ./win64/vc11/obj
MOC_DIR = ./win64/vc11/src
}
LIBS = -L$(CSF_OPT_LIB64)
}
}
DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
@@ -199,3 +116,8 @@ copy_res.CONFIG += no_link target_predeps
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
QMAKE_EXTRA_COMPILERS += copy_res
#QMAKE_CXXFLAGS += /wd4996
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets
}

View File

@@ -1,5 +1,6 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
SET "SAMPLESROOT=%~dp0.."
SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
SET "CSF_ResourcesDefaults=%RES_DIR%"
SET "CSF_IEResourcesDefaults=%RES_DIR%"

View File

@@ -7,6 +7,8 @@ REM third argument specifies Debug or Release mode
call "%~dp0env.bat" %1 %2 %3
set EXT=vcproj
if not "%1" == "" (
if /I "%1" == "vc8" (
set VCVER=vc8
@@ -16,9 +18,11 @@ if not "%1" == "" (
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%1" == "vc10" (
set VCVER=vc10
set EXT=vcxproj
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%1" == "vc11" (
set VCVER=vc11
set EXT=vcxproj
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
) else (
echo Error: first argument ^(%1^) should specify supported version of Visual C++,
@@ -32,4 +36,4 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
call "%VCVARS%" %VCARCH%
qmake -tp vc -r IESample.pro
qmake -tp vc -o IESample.%EXT% IESample.pro

View File

@@ -4,6 +4,7 @@
#include <QMessageBox>
#include <stdlib.h>
#include <QMdiSubWindow>
ApplicationWindow::ApplicationWindow()
: ApplicationCommonWindow( ),
@@ -96,7 +97,7 @@ void ApplicationWindow::createTranslatePopups()
void ApplicationWindow::updateFileActions()
{
if ( getWorkspace()->windowList().isEmpty() )
if ( myDocuments.isEmpty() )
{
if ( !isDocument() )
{
@@ -124,7 +125,7 @@ void ApplicationWindow::onImport()
bool stat = translate( type, true );
if ( stat )
{
DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
doc->fitAll();
}
}
@@ -136,7 +137,7 @@ void ApplicationWindow::onExport()
if ( type < 0 )
return;
bool stat = translate( type, false );
translate( type, false );
}
int ApplicationWindow::translationFormat( const QAction* a )
@@ -181,7 +182,7 @@ int ApplicationWindow::translationFormat( const QAction* a )
bool ApplicationWindow::translate( const int format, const bool import )
{
static Translate* anTrans = createTranslator();
DocumentCommon* doc = ((MDIWindow*) getWorkspace()->activeWindow())->getDocument();
DocumentCommon* doc = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() )->getDocument();
Handle(AIS_InteractiveContext) context = doc->getContext();
bool status;
if ( import )
@@ -210,8 +211,8 @@ void ApplicationWindow::onSelectionChanged()
{
ApplicationCommonWindow::onSelectionChanged();
QWorkspace* ws = getWorkspace();
DocumentCommon* doc = ((MDIWindow*)ws->activeWindow())->getDocument();
QMdiArea* ws = getWorkspace();
DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
Handle(AIS_InteractiveContext) context = doc->getContext();
int numSel = context->NbSelected();
@@ -225,13 +226,15 @@ void ApplicationWindow::onSelectionChanged()
QString ApplicationWindow::getIEResourceDir()
{
static QString resDir( ::getenv( "CSF_IEResourcesDefaults" ) );
return resDir;
static QString aResourceDir =
QString::fromUtf8 (qgetenv ("CSF_IEResourcesDefaults").constData());
return aResourceDir;
}
void ApplicationWindow::onExportImage()
{
MDIWindow* w = (MDIWindow*)getWorkspace()->activeWindow();
MDIWindow* w = qobject_cast<MDIWindow*>( getWorkspace()->activeSubWindow()->widget() );
if ( w )
w->dump();
}

View File

@@ -15,6 +15,7 @@
#include <QFileDialog>
#include <QApplication>
#include <QWidget>
#include <QStyleFactory>
#include <AIS_Shape.hxx>
#include <AIS_InteractiveObject.hxx>
@@ -89,7 +90,9 @@ private:
TranslateDlg::TranslateDlg( QWidget* parent, Qt::WindowFlags flags, bool modal )
: QFileDialog( parent, flags )
{
setOption( QFileDialog::DontUseNativeDialog );
setModal( modal );
QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
if( grid )
@@ -331,7 +334,7 @@ QString Translate::selectFileName( const int format, const bool import )
if ( !QFileInfo( file ).completeSuffix().length() )
{
QString selFilter = theDlg->selectedFilter();
QString selFilter = theDlg->selectedNameFilter();
int idx = selFilter.indexOf( "(*." );
if ( idx != -1 )
{
@@ -371,7 +374,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
cout << filter.toLatin1().constData() << endl;
QStringList filters = filter.split( "\t" );
myDlg->setFilters( filters );
myDlg->setNameFilters ( filters );
if ( import )
{
@@ -384,7 +387,7 @@ TranslateDlg* Translate::getDialog( const int format, const bool import )
((QFileDialog*)myDlg)->setFileMode( QFileDialog::AnyFile );
}
QString datadir = (QString(getenv("CASROOT")) + QObject::tr( QString("INF_PATH_%1").arg( format ).toLatin1().constData() ) );
QString datadir = (QString (qgetenv ("CASROOT").constData()) + QObject::tr( QString("INF_PATH_%1").arg( format ).toLatin1().constData() ) );
myDlg->clear();
@@ -459,7 +462,7 @@ Handle(TopTools_HSequenceOfShape) Translate::importSTEP( const QString& file )
{
bool ok = aReader.TransferRoot( n );
int nbs = aReader.NbShapes();
if ( nbs > 0 )
if ( ok == true && nbs > 0 )
{
aSequence = new TopTools_HSequenceOfShape();
for ( int i = 1; i <= nbs; i++ )

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tutorial", "Tutorial.vcxproj", "{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -8,10 +8,10 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Debug|Win32.ActiveCfg = Debug|Win32
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Debug|Win32.Build.0 = Debug|Win32
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Release|Win32.ActiveCfg = Release|Win32
{59DEDC8A-A5ED-31E8-8F2B-8D996E3A41D6}.Release|Win32.Build.0 = Release|Win32
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.ActiveCfg = Debug|Win32
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Debug|Win32.Build.0 = Debug|Win32
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.ActiveCfg = Release|Win32
{E417B143-8CB4-3EF0-8247-DA6F67FA3FCE}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -3,7 +3,7 @@ CONFIG += debug_and_release qt
TARGET = Tutorial
SAMPLESROOT = $$(CASROOT)/samples/qt
SAMPLESROOT = $$(SAMPLESROOT)
HEADERS = src/*.h \
$${SAMPLESROOT}/Common/src/*.h \
@@ -26,7 +26,9 @@ RES_DIR = $$quote($$(RES_DIR))
INCLUDEPATH += $$quote($${SAMPLESROOT}/Common/src)
INCLUDEPATH += $$quote($${SAMPLESROOT}/Interface/src)
DEFINES = CSFDB
OCCT_DEFINES = $$(CSF_DEFINES)
DEFINES = CSFDB $$split(OCCT_DEFINES, ;)
unix {
UNAME = $$system(uname -s)
@@ -40,11 +42,11 @@ unix {
CONFIG(debug, debug|release) {
DESTDIR = ./$$UNAME/bind
OBJECTS_DIR = ./$$UNAME/objd
MOC_DIR = ./$$UNAME/srcd
MOC_DIR = ./$$UNAME/mocd
} else {
DESTDIR = ./$$UNAME/bin
OBJECTS_DIR = ./$$UNAME/obj
MOC_DIR = ./$$UNAME/src
MOC_DIR = ./$$UNAME/moc
}
MACOSX_USE_GLX = $$(MACOSX_USE_GLX)
@@ -65,107 +67,23 @@ win32 {
CONFIG(debug, debug|release) {
DEFINES += _DEBUG
DESTDIR = ./win$(ARCH)/$(VCVER)/bind
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/objd
MOC_DIR = ./win$(ARCH)/$(VCVER)/mocd
!contains(QMAKE_HOST.arch, x86_64) {
LIBS = -L$(CSF_OPT_LIB32D)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
DESTDIR = ./win32/vc7/bind
OBJECTS_DIR = ./win32/vc7/objd
MOC_DIR = ./win32/vc7/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win32/vc8/bind
OBJECTS_DIR = ./win32/vc8/objd
MOC_DIR = ./win32/vc8/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win32/vc9/bind
OBJECTS_DIR = ./win32/vc9/objd
MOC_DIR = ./win32/vc9/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win32/vc10/bind
OBJECTS_DIR = ./win32/vc10/objd
MOC_DIR = ./win32/vc10/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win32/vc11/bind
OBJECTS_DIR = ./win32/vc11/objd
MOC_DIR = ./win32/vc11/srcd
}
LIBS = -L$(CSF_OPT_LIB32D)
} else {
LIBS = -L$(CSF_OPT_LIB64D)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win64/vc8/bind
OBJECTS_DIR = ./win64/vc8/objd
MOC_DIR = ./win64/vc8/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win64/vc9/bind
OBJECTS_DIR = ./win64/vc9/objd
MOC_DIR = ./win64/vc9/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win64/vc10/bind
OBJECTS_DIR = ./win64/vc10/objd
MOC_DIR = ./win64/vc10/srcd
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win64/vc11/bind
OBJECTS_DIR = ./win64/vc11/objd
MOC_DIR = ./win64/vc11/srcd
}
LIBS = -L$(CSF_OPT_LIB64D)
}
} else {
DEFINES += NDEBUG
DESTDIR = ./win$(ARCH)/$(VCVER)/bin
OBJECTS_DIR = ./win$(ARCH)/$(VCVER)/obj
MOC_DIR = ./win$(ARCH)/$(VCVER)/moc
!contains(QMAKE_HOST.arch, x86_64) {
LIBS = -L$(CSF_OPT_LIB32)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1310) {
DESTDIR = ./win32/vc7/bin
OBJECTS_DIR = ./win32/vc7/obj
MOC_DIR = ./win32/vc7/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win32/vc8/bin
OBJECTS_DIR = ./win32/vc8/obj
MOC_DIR = ./win32/vc8/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win32/vc9/bin
OBJECTS_DIR = ./win32/vc9/obj
MOC_DIR = ./win32/vc9/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win32/vc10/bin
OBJECTS_DIR = ./win32/vc10/obj
MOC_DIR = ./win32/vc10/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win32/vc11/bin
OBJECTS_DIR = ./win32/vc11/obj
MOC_DIR = ./win32/vc11/src
}
LIBS = -L$(CSF_OPT_LIB32)
} else {
LIBS = -L$(CSF_OPT_LIB64)
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1400) {
DESTDIR = ./win64/vc8/bin
OBJECTS_DIR = ./win64/vc8/obj
MOC_DIR = ./win64/vc8/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1500) {
DESTDIR = ./win64/vc9/bin
OBJECTS_DIR = ./win64/vc9/obj
MOC_DIR = ./win64/vc9/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1600) {
DESTDIR = ./win64/vc10/bin
OBJECTS_DIR = ./win64/vc10/obj
MOC_DIR = ./win64/vc10/src
}
contains(QMAKE_COMPILER_DEFINES, _MSC_VER=1700) {
DESTDIR = ./win64/vc11/bin
OBJECTS_DIR = ./win64/vc11/obj
MOC_DIR = ./win64/vc11/src
}
LIBS = -L$(CSF_OPT_LIB64)
}
}
DEFINES +=WNT WIN32 NO_COMMONSAMPLE_EXPORTS NO_IESAMPLE_EXPORTS
@@ -201,4 +119,8 @@ copy_res.CONFIG += no_link target_predeps
win32: copy_res.commands = type ${QMAKE_FILE_IN} > $${RES_DIR}/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
unix: copy_res.commands = cp -f ${QMAKE_FILE_IN} $${RES_DIR}
QMAKE_EXTRA_COMPILERS += copy_res
#QMAKE_CXXFLAGS += /wd4996
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets
}

View File

@@ -1,6 +1,6 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
SET "SAMPLESROOT=%~dp0.."
SET "RES_DIR=%~dp0win%ARCH%\%VCVER%\res"
SET "CSF_ResourcesDefaults=%RES_DIR%"
SET "CSF_TutorialResourcesDefaults=%RES_DIR%"

View File

@@ -7,6 +7,8 @@ REM third argument specifies Debug or Release mode
call "%~dp0env.bat" %1 %2 %3
set EXT=vcproj
if not "%1" == "" (
if /I "%1" == "vc8" (
set VCVER=vc8
@@ -16,9 +18,11 @@ if not "%1" == "" (
set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%1" == "vc10" (
set VCVER=vc10
set EXT=vcxproj
set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
) else if /I "%1" == "vc11" (
set VCVER=vc11
set EXT=vcxproj
set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
) else (
echo Error: first argument ^(%1^) should specify supported version of Visual C++,
@@ -32,4 +36,4 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
call "%VCVARS%" %VCARCH%
qmake -tp vc -r Tutorial.pro
qmake -tp vc -o Tutorial.%EXT% Tutorial.pro

View File

@@ -3,6 +3,7 @@
#include <QFileDialog>
#include <QStatusBar>
#include <QMdiSubWindow>
ApplicationTut::ApplicationTut()
: ApplicationCommonWindow( )
@@ -33,7 +34,7 @@ void ApplicationTut::createMakeBottleOperation(){
void ApplicationTut::updateFileActions()
{
if ( getWorkspace()->windowList().isEmpty() )
if ( getWorkspace()->subWindowList().isEmpty() )
{
if ( !isDocument() )
{
@@ -49,8 +50,8 @@ void ApplicationTut::updateFileActions()
void ApplicationTut::onMakeBottleAction()
{
QWorkspace* ws = ApplicationCommonWindow::getWorkspace();
DocumentTut* doc = (DocumentTut*)((MDIWindow*)ws->activeWindow())->getDocument();
QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
DocumentTut* doc = (DocumentTut*)( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument() );
statusBar()->showMessage( QObject::tr("INF_MAKE_BOTTLE"), 5000 );
doc->onMakeBottle();
statusBar()->showMessage(QObject::tr("INF_DONE"));
@@ -58,7 +59,7 @@ void ApplicationTut::onMakeBottleAction()
QString ApplicationTut::getTutResourceDir()
{
static QString resDir( ::getenv( "CSF_TutorialResourcesDefaults" ) );
return resDir;
static QString resDir (qgetenv ("CSF_TutorialResourcesDefaults").constData());
return resDir;
}

View File

@@ -112,12 +112,3 @@ puts "Showing result..."
vdisplay bottle
vfit
vsetdispmode 1
# set ray tracing
if { [regexp {HAVE_OPENCL} [dversion]] } {
puts "Trying raytrace mode..."
if { ! [catch {vraytrace 1}] } {
vtextureenv on 1
vfit
}
}

39
samples/tcl/raytrace.tcl Normal file
View File

@@ -0,0 +1,39 @@
# Script reproducing creation of bottle model as described in OCCT Tutorial
# make bottle by calling another script
source [file join [file dirname [info script]] bottle.tcl]
# make table and a glass
box table -50 -50 -10 100 100 10
pcone glass_out 7 9 25
pcone glass_in 7 9 25
ttranslate glass_in 0 0 0.2
bcut glass glass_out glass_in
ttranslate glass -30 -30 0
# show table and glass
vsetmaterial bottle aluminium
vdisplay table
vsetmaterial table bronze
vsetmaterial table plastic
vsetcolor table coral2
vdisplay glass
vsetmaterial glass plastic
vsetcolor glass brown
vsettransparency glass 0.6
# add light source for shadows
vlight new spot pos -100 -100 300
# set white background and fit view
vsetcolorbg 255 255 255
vfit
# set ray tracing
if { [regexp {HAVE_OPENCL} [dversion]] } {
puts "Trying raytrace mode..."
if { ! [catch {vraytrace 1}] } {
vtextureenv on 1
vsetraytracemode shad=1 refl=1 aa=1
}
}

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
@@ -146,7 +146,8 @@ uses
StdSelect,
DsgPrs,
TopTools,
Poly
Poly,
Image
is
@@ -241,19 +242,23 @@ is
KOI_Datum,
KOI_Shape,
KOI_Object,
KOI_Relation;
--- Purpose: Declares the type of Interactive Object.
-- This is one of the following:
-- - the Datum
-- - the Object
-- - the Relation
-- - the None type.
-- The Datum is the construction element. These include
-- points, lines, axes and planes. The object brings
-- together topological shapes. The Relation includes
-- dimensions and constraints. When the object is of an
-- unknown type, the None type is declared.
KOI_Relation,
KOI_Dimension;
--- Purpose: Declares the type of Interactive Object.
-- This is one of the following:
-- - the Datum
-- - the Object
-- - the Relation
-- - the Dimension
-- - the None type.
-- The Datum is the construction element. These include
-- points, lines, axes and planes. The object brings
-- together topological shapes. The Relation includes
-- dimensions and constraints. The Dimension includes
-- length, radius, diameter and angle dimensions.
-- When the object is of an unknown type, the None
-- type is declared.
enumeration ClearMode is
CM_All,
CM_Interactive,
@@ -320,7 +325,7 @@ is
class Triangulation;
class TexturedShape;
imported TexturedShape;
class Drawer;

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
@@ -48,6 +48,7 @@
#include <Select3D_SensitiveGroup.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <SelectMgr_Selection.hxx>
#include <Standard_ProgramError.hxx>
#include <UnitsAPI.hxx>
IMPLEMENT_STANDARD_HANDLE (AIS_AngleDimension, AIS_Dimension)
@@ -144,19 +145,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Edge& theFirstEdge,
{
gp_Pln aComputedPlane;
myFirstShape = theFirstEdge;
mySecondShape = theSecondEdge;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Edges;
myIsValid = InitTwoEdgesAngle (aComputedPlane);
myFirstShape = theFirstEdge;
mySecondShape = theSecondEdge;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Edges;
myIsGeometryValid = InitTwoEdgesAngle (aComputedPlane);
if (myIsValid && !myIsPlaneCustom)
if (myIsGeometryValid && !myIsPlaneCustom)
{
myPlane = aComputedPlane;
ComputePlane();
}
myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
@@ -175,15 +174,13 @@ void AIS_AngleDimension::SetMeasuredGeometry (const gp_Pnt& theFirstPoint,
mySecondShape = BRepLib_MakeVertex (myCenterPoint);
myThirdShape = BRepLib_MakeVertex (mySecondPoint);
myGeometryType = GeometryType_Points;
myIsValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
myIsGeometryValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
if (myIsValid && !myIsPlaneCustom)
if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
@@ -195,22 +192,20 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Vertex& theFirstVerte
const TopoDS_Vertex& theSecondVertex,
const TopoDS_Vertex& theThirdVertex)
{
myFirstShape = theFirstVertex;
mySecondShape = theSecondVertex;
myThirdShape = theThirdVertex;
myFirstPoint = BRep_Tool::Pnt (theFirstVertex);
myCenterPoint = BRep_Tool::Pnt (theSecondVertex);
mySecondPoint = BRep_Tool::Pnt (theThirdVertex);
myGeometryType = GeometryType_Points;
myIsValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
myFirstShape = theFirstVertex;
mySecondShape = theSecondVertex;
myThirdShape = theThirdVertex;
myFirstPoint = BRep_Tool::Pnt (theFirstVertex);
myCenterPoint = BRep_Tool::Pnt (theSecondVertex);
mySecondPoint = BRep_Tool::Pnt (theThirdVertex);
myGeometryType = GeometryType_Points;
myIsGeometryValid = IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
if (myIsValid && !myIsPlaneCustom)
if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
@@ -220,19 +215,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Vertex& theFirstVerte
//=======================================================================
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theCone)
{
myFirstShape = theCone;
mySecondShape = TopoDS_Shape();
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Face;
myIsValid = InitConeAngle();
myFirstShape = theCone;
mySecondShape = TopoDS_Shape();
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Face;
myIsGeometryValid = InitConeAngle();
if (myIsValid && !myIsPlaneCustom)
if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
@@ -243,19 +236,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theCone)
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
const TopoDS_Face& theSecondFace)
{
myFirstShape = theFirstFace;
mySecondShape = theSecondFace;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Faces;
myIsValid = InitTwoFacesAngle();
myFirstShape = theFirstFace;
mySecondShape = theSecondFace;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Faces;
myIsGeometryValid = InitTwoFacesAngle();
if (myIsValid && !myIsPlaneCustom)
if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
@@ -267,19 +258,17 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
const TopoDS_Face& theSecondFace,
const gp_Pnt& thePoint)
{
myFirstShape = theFirstFace;
mySecondShape = theSecondFace;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Faces;
myIsValid = InitTwoFacesAngle (thePoint);
myFirstShape = theFirstFace;
mySecondShape = theSecondFace;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Faces;
myIsGeometryValid = InitTwoFacesAngle (thePoint);
if (myIsValid && !myIsPlaneCustom)
if (myIsGeometryValid && !myIsPlaneCustom)
{
ComputePlane();
}
myIsValid &= CheckPlane (myPlane);
SetToUpdate();
}
@@ -300,7 +289,7 @@ void AIS_AngleDimension::Init()
//=======================================================================
gp_Pnt AIS_AngleDimension::GetCenterOnArc (const gp_Pnt& theFirstAttach,
const gp_Pnt& theSecondAttach,
const gp_Pnt& theCenter)
const gp_Pnt& theCenter) const
{
// construct plane where the circle and the arc are located
gce_MakePln aConstructPlane (theFirstAttach, theSecondAttach, theCenter);
@@ -517,7 +506,7 @@ Standard_Boolean AIS_AngleDimension::CheckPlane (const gp_Pln& thePlane)const
//=======================================================================
void AIS_AngleDimension::ComputePlane()
{
if (!IsValid())
if (!myIsGeometryValid)
{
return;
}
@@ -583,7 +572,7 @@ Standard_Real AIS_AngleDimension::ComputeValue() const
Standard_Real anAngle = aVec2.AngleWithRef (aVec1, GetPlane().Axis().Direction());
return anAngle > 0.0 ? anAngle : (2.0 * M_PI - anAngle);
return anAngle > 0.0 ? anAngle : (2.0 * M_PI + anAngle);
}
//=======================================================================
@@ -619,31 +608,23 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
aLabelWidth += aDimensionAspect->TextAspect()->Height() * THE_3D_TEXT_MARGIN * 2.0;
}
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, myFirstPoint).Normalized() * GetFlyout());
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, mySecondPoint).Normalized() * GetFlyout());
// Get parameters from aspect or adjust it according with custom text position
Standard_Real anExtensionSize = aDimensionAspect->ExtensionSize();
Prs3d_DimensionTextHorizontalPosition aHorisontalTextPos = aDimensionAspect->TextHorizontalPosition();
if (IsTextPositionCustom())
{
AdjustParameters (myFixedTextPosition,anExtensionSize, aHorisontalTextPos, myFlyout);
}
// Handle user-defined and automatic arrow placement
bool isArrowsExternal = false;
switch (aDimensionAspect->ArrowOrientation())
{
case Prs3d_DAO_External: isArrowsExternal = true; break;
case Prs3d_DAO_Internal: isArrowsExternal = false; break;
case Prs3d_DAO_Fit:
{
gp_Vec anAttachVector (aFirstAttach, aSecondAttach);
Standard_Real aDimensionWidth = anAttachVector.Magnitude();
Standard_Boolean isArrowsExternal = Standard_False;
Standard_Integer aLabelPosition = LabelPosition_None;
// add margin to ensure a small tail between text and arrow
Standard_Real anArrowMargin = aDimensionAspect->IsText3d()
? aDimensionAspect->TextAspect()->Height() * THE_3D_TEXT_MARGIN
: 0.0;
FitTextAlignment (aHorisontalTextPos, aLabelPosition, isArrowsExternal);
Standard_Real anArrowsWidth = (anArrowLength + anArrowMargin) * 2.0;
isArrowsExternal = aDimensionWidth < aLabelWidth + anArrowsWidth;
break;
}
}
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, myFirstPoint).Normalized() * GetFlyout());
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, mySecondPoint).Normalized() * GetFlyout());
//Arrows positions and directions
gp_Vec aWPDir = gp_Vec (GetPlane().Axis().Direction());
@@ -670,38 +651,9 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
aFirstArrowEnd = aFirstAttach.Translated (-aFirstArrowVec);
aSecondArrowEnd = aSecondAttach.Translated (-aSecondArrowVec);
Standard_Integer aLabelPosition = LabelPosition_None;
// Handle user-defined and automatic text placement
switch (aDimensionAspect->TextHorizontalPosition())
{
case Prs3d_DTHP_Left : aLabelPosition |= LabelPosition_Left; break;
case Prs3d_DTHP_Right : aLabelPosition |= LabelPosition_Right; break;
case Prs3d_DTHP_Center: aLabelPosition |= LabelPosition_HCenter; break;
case Prs3d_DTHP_Fit:
{
gp_Vec anAttachVector (aFirstAttach, aSecondAttach);
Standard_Real aDimensionWidth = anAttachVector.Magnitude();
Standard_Real anArrowsWidth = anArrowLength * 2.0;
Standard_Real aContentWidth = isArrowsExternal ? aLabelWidth : aLabelWidth + anArrowsWidth;
aLabelPosition |= aDimensionWidth < aContentWidth ? LabelPosition_Left : LabelPosition_HCenter;
break;
}
}
switch (aDimensionAspect->TextVerticalPosition())
{
case Prs3d_DTVP_Above : aLabelPosition |= LabelPosition_Above; break;
case Prs3d_DTVP_Below : aLabelPosition |= LabelPosition_Below; break;
case Prs3d_DTVP_Center : aLabelPosition |= LabelPosition_VCenter; break;
}
// Group1: stenciling text and the angle dimension arc
Prs3d_Root::NewGroup (thePresentation);
Standard_Real anExtensionSize = aDimensionAspect->ExtensionSize();
Standard_Integer aHPosition = aLabelPosition & LabelPosition_HMask;
// draw text label
@@ -729,7 +681,8 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
{
gp_Vec aDimensionDir (aFirstAttach, aSecondAttach);
gp_Pnt aTextPos = GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint);
gp_Pnt aTextPos = IsTextPositionCustom() ? myFixedTextPosition
: GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint);
gp_Dir aTextDir = aDimensionDir;
DrawText (thePresentation,
@@ -807,7 +760,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
if (aHPosition != LabelPosition_Left)
{
DrawExtension (thePresentation,
anExtensionSize,
aDimensionAspect->ArrowTailSize(),
aFirstArrowEnd,
aFirstExtensionDir,
THE_EMPTY_LABEL_STRING,
@@ -819,7 +772,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
if (aHPosition != LabelPosition_Right)
{
DrawExtension (thePresentation,
anExtensionSize,
aDimensionAspect->ArrowTailSize(),
aSecondArrowEnd,
aSecondExtensionDir,
THE_EMPTY_LABEL_STRING,
@@ -845,7 +798,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
}
myIsComputed = Standard_True;
mySelectionGeom.IsComputed = Standard_True;
}
//=======================================================================
@@ -1184,3 +1137,269 @@ Standard_Boolean AIS_AngleDimension::IsValidPoints (const gp_Pnt& theFirstPoint,
&& gp_Vec (theCenterPoint, theFirstPoint).Angle (
gp_Vec (theCenterPoint, theSecondPoint)) > Precision::Angular();
}
//=======================================================================
//function : GetTextPosition
//purpose :
//=======================================================================
const gp_Pnt AIS_AngleDimension::GetTextPosition() const
{
if (!IsValid())
{
return gp::Origin();
}
if (IsTextPositionCustom())
{
return myFixedTextPosition;
}
// Counts text position according to the dimension parameters
gp_Pnt aTextPosition (gp::Origin());
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
// Prepare label string and compute its geometrical width
Standard_Real aLabelWidth;
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, myFirstPoint).Normalized() * GetFlyout());
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, mySecondPoint).Normalized() * GetFlyout());
// Handle user-defined and automatic arrow placement
Standard_Boolean isArrowsExternal = Standard_False;
Standard_Integer aLabelPosition = LabelPosition_None;
FitTextAlignment (aDimensionAspect->TextHorizontalPosition(),
aLabelPosition, isArrowsExternal);
// Get text position
switch (aLabelPosition & LabelPosition_HMask)
{
case LabelPosition_HCenter:
{
aTextPosition = GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint);
}
break;
case LabelPosition_Left:
{
gp_Dir aPlaneNormal = gp_Vec (aFirstAttach, aSecondAttach) ^ gp_Vec (myCenterPoint, aFirstAttach);
gp_Dir anExtensionDir = aPlaneNormal ^ gp_Vec (myCenterPoint, aFirstAttach);
Standard_Real anExtensionSize = aDimensionAspect->ExtensionSize();
Standard_Real anOffset = isArrowsExternal
? anExtensionSize + aDimensionAspect->ArrowAspect()->Length()
: anExtensionSize;
gp_Vec anExtensionVec = gp_Vec (anExtensionDir) * -anOffset;
aTextPosition = aFirstAttach.Translated (anExtensionVec);
}
break;
case LabelPosition_Right:
{
gp_Dir aPlaneNormal = gp_Vec (aFirstAttach, aSecondAttach) ^ gp_Vec (myCenterPoint, aFirstAttach);
gp_Dir anExtensionDir = aPlaneNormal ^ gp_Vec (myCenterPoint, aSecondAttach);
Standard_Real anExtensionSize = aDimensionAspect->ExtensionSize();
Standard_Real anOffset = isArrowsExternal
? anExtensionSize + aDimensionAspect->ArrowAspect()->Length()
: anExtensionSize;
gp_Vec anExtensionVec = gp_Vec (anExtensionDir) * anOffset;
aTextPosition = aSecondAttach.Translated (anExtensionVec);
}
break;
}
return aTextPosition;
}
//=======================================================================
//function : SetTextPosition
//purpose :
//=======================================================================
void AIS_AngleDimension::SetTextPosition (const gp_Pnt& theTextPos)
{
if (!IsValid())
{
return;
}
// The text position point for angle dimension should belong to the working plane.
if (!GetPlane().Contains (theTextPos, Precision::Confusion()))
{
Standard_ProgramError::Raise ("The text position point for angle dimension doesn't belong to the working plane.");
}
myIsTextPositionFixed = Standard_True;
myFixedTextPosition = theTextPos;
}
//=======================================================================
//function : AdjustParameters
//purpose :
//=======================================================================
void AIS_AngleDimension::AdjustParameters (const gp_Pnt& theTextPos,
Standard_Real& theExtensionSize,
Prs3d_DimensionTextHorizontalPosition& theAlignment,
Standard_Real& theFlyout) const
{
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Standard_Real anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// Compute flyout direction vector.
gp_Dir aPlaneNormal = GetPlane().Axis().Direction();
gp_Dir aTargetPointsDir = gce_MakeDir (myFirstPoint, mySecondPoint);
// Build circle with radius that is equal to distance from text position to the center point.
Standard_Real aRadius = gp_Vec (myCenterPoint, theTextPos).Magnitude();
// Set attach points in positive direction of the flyout.
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec (myCenterPoint, myFirstPoint).Normalized() * aRadius);
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec (myCenterPoint, mySecondPoint).Normalized() * aRadius);
gce_MakeCirc aConstructCircle (myCenterPoint, GetPlane(), aRadius);
if (!aConstructCircle.IsDone())
{
return;
}
gp_Circ aCircle = aConstructCircle.Value();
// Default values
theExtensionSize = aDimensionAspect->ArrowAspect()->Length();
theAlignment = Prs3d_DTHP_Center;
Standard_Real aParamBeg = ElCLib::Parameter (aCircle, aFirstAttach);
Standard_Real aParamEnd = ElCLib::Parameter (aCircle, aSecondAttach);
if (aParamEnd < aParamBeg)
{
Standard_Real aParam = aParamEnd;
aParamEnd = aParamBeg;
aParamBeg = aParam;
}
ElCLib::AdjustPeriodic (0.0, M_PI * 2, Precision::PConfusion(), aParamBeg, aParamEnd);
Standard_Real aTextPar = ElCLib::Parameter (aCircle , theTextPos);
// Horizontal center
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
{
theFlyout = aRadius;
return;
}
aParamBeg += M_PI;
aParamEnd += M_PI;
ElCLib::AdjustPeriodic (0.0, M_PI * 2, Precision::PConfusion(), aParamBeg, aParamEnd);
if (aTextPar > aParamBeg && aTextPar < aParamEnd)
{
theFlyout = -aRadius;
return;
}
// Text on the extensions
gp_Lin aFirstLine = gce_MakeLin (myCenterPoint, myFirstPoint);
gp_Lin aSecondLine = gce_MakeLin (myCenterPoint, mySecondPoint);
gp_Pnt aFirstTextProj = AIS::Nearest (aFirstLine, theTextPos);
gp_Pnt aSecondTextProj = AIS::Nearest (aSecondLine, theTextPos);
Standard_Real aFirstDist = aFirstTextProj.Distance (theTextPos);
Standard_Real aSecondDist = aSecondTextProj.Distance (theTextPos);
if (aFirstDist <= aSecondDist)
{
aRadius = myCenterPoint.Distance (aFirstTextProj);
Standard_Real aNewExtensionSize = aFirstDist - anArrowLength;
theExtensionSize = aNewExtensionSize < 0.0 ? 0.0 : aNewExtensionSize;
theAlignment = Prs3d_DTHP_Left;
gp_Vec aPosFlyoutDir = gp_Vec (myCenterPoint, myFirstPoint).Normalized().Scaled (aRadius);
theFlyout = aFirstTextProj.Distance (myCenterPoint.Translated (aPosFlyoutDir)) > Precision::Confusion()
? -aRadius : aRadius;
}
else
{
aRadius = myCenterPoint.Distance (aSecondTextProj);
Standard_Real aNewExtensionSize = aSecondDist - anArrowLength;
theExtensionSize = aNewExtensionSize < 0.0 ? 0.0 : aNewExtensionSize;
theAlignment = Prs3d_DTHP_Right;
gp_Vec aPosFlyoutDir = gp_Vec (myCenterPoint, mySecondPoint).Normalized().Scaled (aRadius);
theFlyout = aSecondTextProj.Distance (myCenterPoint.Translated (aPosFlyoutDir)) > Precision::Confusion()
? -aRadius : aRadius;
}
}
//=======================================================================
//function : FitTextAlignment
//purpose :
//=======================================================================
void AIS_AngleDimension::FitTextAlignment (const Prs3d_DimensionTextHorizontalPosition& theHorizontalTextPos,
Standard_Integer& theLabelPosition,
Standard_Boolean& theIsArrowsExternal) const
{
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// Prepare label string and compute its geometrical width
Standard_Real aLabelWidth;
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
// add margins to label width
if (aDimensionAspect->IsText3d())
{
aLabelWidth += aDimensionAspect->TextAspect()->Height() * THE_3D_TEXT_MARGIN * 2.0;
}
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec (myCenterPoint, myFirstPoint).Normalized() * GetFlyout());
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec (myCenterPoint, mySecondPoint).Normalized() * GetFlyout());
// Handle user-defined and automatic arrow placement
switch (aDimensionAspect->ArrowOrientation())
{
case Prs3d_DAO_External: theIsArrowsExternal = true; break;
case Prs3d_DAO_Internal: theIsArrowsExternal = false; break;
case Prs3d_DAO_Fit:
{
gp_Vec anAttachVector (aFirstAttach, aSecondAttach);
Standard_Real aDimensionWidth = anAttachVector.Magnitude();
// Add margin to ensure a small tail between text and arrow
Standard_Real anArrowMargin = aDimensionAspect->IsText3d()
? aDimensionAspect->TextAspect()->Height() * THE_3D_TEXT_MARGIN
: 0.0;
Standard_Real anArrowsWidth = (anArrowLength + anArrowMargin) * 2.0;
theIsArrowsExternal = aDimensionWidth < aLabelWidth + anArrowsWidth;
break;
}
}
// Handle user-defined and automatic text placement
switch (theHorizontalTextPos)
{
case Prs3d_DTHP_Left : theLabelPosition |= LabelPosition_Left; break;
case Prs3d_DTHP_Right : theLabelPosition |= LabelPosition_Right; break;
case Prs3d_DTHP_Center: theLabelPosition |= LabelPosition_HCenter; break;
case Prs3d_DTHP_Fit:
{
gp_Vec anAttachVector (aFirstAttach, aSecondAttach);
Standard_Real aDimensionWidth = anAttachVector.Magnitude();
Standard_Real anArrowsWidth = anArrowLength * 2.0;
Standard_Real aContentWidth = theIsArrowsExternal ? aLabelWidth : aLabelWidth + anArrowsWidth;
theLabelPosition |= aDimensionWidth < aContentWidth ? LabelPosition_Left : LabelPosition_HCenter;
break;
}
}
switch (aDimensionAspect->TextVerticalPosition())
{
case Prs3d_DTVP_Above : theLabelPosition |= LabelPosition_Above; break;
case Prs3d_DTVP_Below : theLabelPosition |= LabelPosition_Below; break;
case Prs3d_DTVP_Center : theLabelPosition |= LabelPosition_VCenter; break;
}
}

View File

@@ -3,8 +3,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
@@ -47,8 +47,8 @@ DEFINE_STANDARD_HANDLE (AIS_AngleDimension, AIS_Dimension)
//! as through three defined points can be built only one plane.
//! Therefore, if user-defined plane differs from this one, the dimension can't be built.
//!
//! In cases of two planes automatical plane by default is built on point of the
//! origin of parametrical space of the first face (the basis surface) so, that
//! In cases of two planes automatic plane by default is built on point of the
//! origin of parametric space of the first face (the basis surface) so, that
//! the working plane and two faces intersection forms minimal angle between the faces.
//! User can define the other point which the dimension plane should pass through
//! using the appropriate constructor. This point can lay on the one of the faces or not.
@@ -188,15 +188,25 @@ public:
const gp_Pnt& thePoint);
//! @return the display units string.
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits () const;
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const;
//! @return the model units string.
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits () const;
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits() const;
Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
//! Principle of horizontal text alignment settings:
//! - divide circle into two halves according to attachment points
//! - if aTextPos is between attach points -> Center + positive flyout
//! - if aTextPos is not between attach points but in this half -> Left or Right + positive flyout
//! - if aTextPos is between reflections of attach points -> Center + negative flyout
//! - if aTextPos is not between reflections of attach points -> Left or Right + negative flyout
Standard_EXPORT virtual void SetTextPosition (const gp_Pnt& theTextPos);
Standard_EXPORT virtual const gp_Pnt GetTextPosition () const;
public:
DEFINE_STANDARD_RTTI (AIS_AngleDimension)
@@ -212,7 +222,7 @@ protected:
//! @return the center of the dimension arc (the main dimension line in case of angle).
Standard_EXPORT gp_Pnt GetCenterOnArc (const gp_Pnt& theFirstAttach,
const gp_Pnt& theSecondAttach,
const gp_Pnt& theCenter);
const gp_Pnt& theCenter) const;
//! Draws main dimension line (arc).
//! @param thePresentation [in] the dimension presentation.
@@ -247,6 +257,30 @@ protected:
const Standard_Integer theMode,
const Standard_Integer theLabelPosition);
//! Fits text alignment relatively to the dimension line;
//! it computes the value of label position and arrow orientation
//! according set in the aspect and dimension properties.
//! @param theHorizontalTextPos [in] the horizontal alignment for text position.
//! @param theLabelPosition [out] the label position, contains bits that defines
//! vertical and horizontal alignment. (for internal usage in count text position).
//! @param theIsArrowExternal [out] is the arrows external,
//! if arrow orientation in the dimension aspect is Prs3d_DAO_Fit, it fits arrow
//! orientation automatically.
Standard_EXPORT void FitTextAlignment (const Prs3d_DimensionTextHorizontalPosition& theHorizontalTextPos,
Standard_Integer& theLabelPosition,
Standard_Boolean& theIsArrowsExternal) const;
//! Adjusts aspect parameters according the text position:
//! extension size, vertical text alignment and flyout.
//! @param theTextPos [in] the user defined 3d point of text position.
//! @param theExtensionSize [out] the adjusted extension size.
//! @param theAlignment [out] the horizontal label alignment.
//! @param theFlyout [out] the adjusted value of flyout.
Standard_EXPORT void AdjustParameters (const gp_Pnt& theTextPos,
Standard_Real& theExtensionSize,
Prs3d_DimensionTextHorizontalPosition& theAlignment,
Standard_Real& theFlyout) const;
protected:
Standard_EXPORT virtual void ComputePlane();

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and / or modify it
-- under the terms of the GNU Lesser General Public version 2.1 as published
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.

View File

@@ -5,8 +5,8 @@
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and / or modify it
// under the terms of the GNU Lesser General Public version 2.1 as published
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.

Some files were not shown because too many files have changed in this diff Show More