1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

...

109 Commits

Author SHA1 Message Date
apn
82b4c24940 Update of template for compilation in debug mode 2014-11-10 13:14:44 +03:00
bugmaster
32d5cd7b98 Incrementation of OCCT version up to 6.8.0 2014-11-07 17:56:30 +03:00
kgv
7f2debb25f 0025195: Samples - add Java sample for Android 4.x 2014-11-07 17:53:53 +03:00
ibs
80eb96707a 0025149: Samples - add Qt5/QML sample for Android 4.x 2014-11-07 17:53:52 +03:00
emv
c088aa932f 0025446: The method BRepAlgoAPI_BooleanOperation::IsDeleted() returns TRUE for the faces contained in the result of BOP
1. The method
  Standard_Boolean BOPAlgo_Builder::IsDeleted
    (const TopoDS_Shape& theS)
  has been modified to return TRUE only if the shape theS has been deleted.
2. Added new draw (QA) command OCC25446 to test this method.
2014-11-07 17:10:49 +03:00
apn
46c99a694f 0025420: Wrong result obtained by General Fuse operator.
Added test case bugs/modalg_5/bug25420
2014-11-07 14:20:40 +03:00
bugmaster
db348d8c53 Update CMakeLists.txt for standard mfc sample 2014-11-07 14:18:45 +03:00
kgv
93e572caa0 0025438: Visualization, TKOpenGl - always setup viewport within OpenGl_Workspace::Redraw()
suppress new warning
2014-11-07 14:01:42 +03:00
oan
49cfd13dca 0025445: Draw command incmesh should support all parameters used in BRepMesh
Test-case for issue #25445
2014-11-06 16:05:48 +03:00
apn
2fa97a4304 0025270: OCCT fails to calculate extrema between extruded surface and line
Added test case bugs/modalg_5/bug25270
2014-11-06 16:03:16 +03:00
Roman Lygin
2dc8b7cc5b 0025439: Enabling shape binary persistence without OCAF 2014-11-06 16:01:02 +03:00
pdn
947085567f 0025367: IGES and BRep persistence - support unicode file names on Windows
OSD_OpenFile.hxx header is created for using in file open operations with Unicode names.

Fix for STEP files reading.

Adding test cases for issue 25367
Update test case for issue 25364
Update test cases due to improvements
2014-11-06 13:55:51 +03:00
oan
2caff0b32f 0025364: BRepMesh is not able to triangulate the shape with fine deflection
Don't create data structures for whole set of faces. Necessary structures are created directly in BRepMesh_FastDiscret.
Don't copy nodes data during scaling, single structure is used.

Remove lines used for debug

Fix sphere: resolve problem came from merging.

Keep code clean - remove unnecessary logic, expected to be used for complicated restoration process.

Test cases for issue CR25364
2014-11-05 17:58:23 +03:00
kgv
e3573bb9ec 0025438: Visualization, TKOpenGl - always setup viewport within OpenGl_Workspace::Redraw() 2014-11-05 17:54:49 +03:00
duv
c827ea3a68 0024381: Visualization, TKOpenGl - revise matrices stack and usage of temporary matrices
0025301: Visualization, TKOpenGl - transpose matrix manually before glUniformMatrix4fv()

OpenGl_View::ReleaseGlResources() - release GL resources of trihedron, do not destroy it
2014-11-05 17:54:48 +03:00
kgv
00ea319b16 0025442: Visualization, TKOpenGl - prevent inclusion of system header glxext.h
Define GLX_GLXEXT_LEGACY in addition to GL_GLEXT_LEGACY to prevent implicit
inclusion of header GL/glxext.h by system header GL/glx.h

Update glext.t to current state.
2014-11-05 17:48:03 +03:00
kgv
f3fb84ce21 0025443: Documentation - update packages names in Building 3rd-party libraries on Linux
Update README files for samples
2014-11-05 17:44:12 +03:00
isz
18006a0f10 0025343: Visualization - Update user's guide and DRAW commands description
Redesign of Visualisation user guide's structure with some changes in the guide.
Update Draw_test_harness user guide. Added dimension commands to DRAW test harness.
Update of prerequisites and building 3rd party tools sections
Move VIS draw tests to Draw Test Harness section.

Additionally, fix bugs 24117 and 25353.
Correct output of new imaged in PDF in modeling algos guide and errors introduced by bug 24699 in the overview.
2014-11-05 17:44:03 +03:00
razmyslovich
b350f6ee1e 0025174: Provide ShapeCustom and BRepModifier with ProgressIndicator and ReShape features
Conflicts:
	src/TNaming/TNaming_Name.cxx
2014-11-05 17:32:34 +03:00
aml
2958244411 0024934: Section: crash for two faces
Added protection from null vertexes.

Test case for issue CR24934
2014-11-05 17:27:09 +03:00
ski
2c5b6d9c12 0024548: Ray Tracing mode not available in MFC samples
Ray tracing functionality was added to OCCT MFC samples.
2014-11-05 17:17:47 +03:00
apn
a806787bd6 0025157: Face missing depending the angle of revolution
Added test case bugs/mesh/bug25157
2014-11-05 17:07:33 +03:00
apn
5e5ce65be4 0022125: TCollection_ExtendedString: conversion from UTF-8 to unicode
Added test case bugs/fclasses/bug22125
2014-11-05 17:04:46 +03:00
azv
6fb3418ea1 0025413: Line-Shape intersection algorithm became 400 times slower
Changed the procedure of creating initial samples

Test-case for issue #25413
2014-11-05 17:02:58 +03:00
abv
0797d9d30a 0025418: Debug output to be limited to OCC development environment
Macros ending on "DEB" are replaced by OCCT_DEBUG across OCCT code; new macros described in documentation.
Macros starting with DEB are changed to start with "OCCT_DEBUG_".
Some code cleaned.
2014-11-05 16:55:24 +03:00
apn
a507ffd9d7 0025307: Problems resulted from re-triangulation
Added test case bugs/mesh/bug25307
2014-11-05 16:51:08 +03:00
apn
3edc7eea42 0024519: Intersection of a cylinder and a plane does not return
Added test case bugs/modalg_5/bug24519
2014-11-05 16:49:15 +03:00
apn
dbf0485ef0 0025281: BRepMesh_IncrementalMesh does not return
Added test case bugs/mesh/bug25281
2014-11-05 16:48:00 +03:00
ifv
43dbdb15db 0025427: Algorithm of building plane from wire hangs
Test-case for issue #25427
2014-11-05 16:47:36 +03:00
bugmaster
3908084224 Update for building with MS Visual C++ without VTK 3rdparty products 2014-11-05 15:53:31 +03:00
nbv
e98e39903b 0025410: Tool for extended check of validity of the curve on the surface
Modifications:
1. class BOPTools_AlgoTools
1.1. method
 Standard_Boolean BOPTools_AlgoTools::ComputeTolerance
  (const Handle(Geom_Curve)& theCurve3D,
   const Handle(Geom2d_Curve)& theCurve2D,
   const Handle(Geom_Surface)& theSurf,
   const Standard_Real theFirst,
   const Standard_Real theLast,
   Standard_Real& theMaxDist,
   Standard_Real& theMaxPar)
  It computes the max distance between points taken from 3D and 2D curves by the same parameter

1.2. method
 Standard_Boolean BOPTools_AlgoTools::ComputeTolerance
  (const TopoDS_Face& theFace,
   const TopoDS_Edge& theEdge,
   Standard_Real& theMaxDist,
   Standard_Real& theParameter)
  Computes the valid value of the tolerance for the edge using the function above.

2.  Added possibility to check shape on the validity of the curves on the surfaces.
2.1. New status BOPAlgo_InvalidCurveOnSurface has been added to the enumeration BOPAlgo_CheckStatus
2.2. class BOPAlgo_ArgumentAnalyzer
 method
   void BOPAlgo_ArgumentAnalyzer::TestCurveOnSurface()
 It checks each edge/face pair in the shape using the method ComputeTolerance from BOPTools_AlgoTools and stores invalid pairs to myResults.
 Invalid pairs are those which contain the edge with tolerance value less then the value computed by the ComputeTolerance method.

2.3. class BOPAlgo_CheckResult
 Added new fields:
    myMaxDist1 : Real from Standard;
    myMaxDist2 : Real from Standard;
    myMaxPar1  : Real from Standard;
    myMaxPar2  : Real from Standard;
 and corresponding setters and getters.
 These fields are used to store the results of the TestCurveOnSurface() check.

3. Added new option to the bopargcheck command and two new commands.
class BOPTest_CheckCommands
3.1. command bopargcheck
 As it is using the BOPAlgo_ArgumentAnalyzer class to check the shapes
 it checks also the validity of the curves on the surfaces.
 The output for the invalid shapes is following:

Draw[]> bopargcheck b2 /ic #f
Made faulty shape: s1COnS_1 (MaxDist = 0.0013334343378738308, MaxPar = 0.02884285498274167)
Made faulty shape: s1COnS_2 (MaxDist = 0.0013334340648766174, MaxPar = 0.02884285497934707)
Made faulty shape: s1COnS_3 (MaxDist = 0.0013335086668628978, MaxPar = 1.4133051942712607)
Made faulty shape: s1COnS_4 (MaxDist = 0.0013335086525838983, MaxPar = 1.4133051942713901)
Faulties for FIRST  shape found : 4
---------------------------------
Shapes are not suppotrted by BOP: NO
Self-Intersections              : NO
Check for SI has been aborted   : NO
Too small edges                 : NO
Bad faces                       : NO
Too close vertices              : NO
Too close edges                 : NO
Shapes with Continuity C0       : NO
Invalid Curve on Surface        : YES  Cases(4)  Total shapes(8)

Faulties for SECOND  shape found : 0

 The compounds s1COnS_* contain pair of edge and face.
 MaxDist is maximal distance between points taken from 3D curve of the edge and 2D curve of that edge on the face.
 MaxPar is a parameter in which the MaxDist is reached.

 To disable this check it is necessary to use option /S (bopargcheck shape /S).

3.2. command xdistef
 Usage of the command:
   xdistef edge face
 It computes distance between points taken from 3D curve of the edge and 2D curve of that edge on the face.
 Example:
Draw[]> explode s1COnS_1
s1COnS_1_1 s1COnS_1_2
Draw[]> whatis s1COnS_1_1
s1COnS_1_1 is a shape EDGE FORWARD Modified Orientable
Draw[]> whatis s1COnS_1_2
s1COnS_1_2 is a shape FACE FORWARD Modified Orientable
Draw[]> xdistef s1COnS_1_1 s1COnS_1_2
Max Distance = 0.0013334343378738308; Parameter on curve = 0.02884285498274167

3.3. command checkcurveonsurf
 Usage of the command:
  checkcurveonsurf shape.
 It checks each edge/face pair in the shape using the method ComputeTolerance from BOPTools_AlgoTools.
Example:
Draw[]> checkcurveonsurf b2
Invalid curves on surface:
edge e_0 on face f_0 (max dist: 0.0013334343378738, parameter on curve: 0.0288428549827417)
edge e_1 on face f_0 (max dist: 0.0013334340648766, parameter on curve: 0.0288428549793471)
edge e_2 on face f_1 (max dist: 0.0013335086668629, parameter on curve: 1.4133051942712607)
edge e_3 on face f_1 (max dist: 0.0013335086525839, parameter on curve: 1.4133051942713901)

Sugestions to fix the shape:
explode b2 e;
settolerance b2_6 0.0013335086668629;
settolerance b2_7 0.0013334343378738;
settolerance b2_8 0.0013334340648766;
settolerance b2_10 0.0013335086525839;

The command gives suggestions to fix the shape by increasing tolerance values of the invalid edges.
In some cases the tolerance values suggested by the tool can be very large.
Such values should be used very carefully, because setting large tolerance values to the sub-shapes
of the shape can make it non valid (self-interfered) or lead to unexpected result when using
such shapes in some operations (boolean for example).

Test case for issue CR25410
2014-10-30 14:27:29 +03:00
kgv
05e2200bbf 0025422: Visualization, TKOpenGl - support re-assignment of new window to existing View
Do not throw "Window already defined" exception in Visual3d_View/V3d_View.
Handle window change within OpenGl_GraphicDriver::View().

OpenGl_GraphicDriver - introduce dedicated methods to initialize/release shared OpenGL context.
::InitEglContext() to using existing EGL context.

OpenGl_Context - always enable NPOT textures on OpenGL ES 2.0

OpenGl_Workspace - do not call glDisable/glEnable(GL_TEXTURE_2D) on GL ES

OpenGl_GraphicDriver::ReleaseContext() - release EGL context on destruction

OpenGl_GraphicDriver::InitEglContext() - escape method implementation with HAVE_EGL macros

OpenGl_ShaderManager - clear shader programs on shared context invalidation
2014-10-30 13:52:02 +03:00
emv
524a5f7aa7 0025337: Regression to version 6.7.1 : boolean operations fail on two planar circular faces lying in the same plane
class IntTools_EdgeEdge
method
  void IntTools_EdgeEdge::FindSolutions(const IntTools_Range& theR1,
                                        const IntTools_Range& theR2,
                                        const Bnd_Box& theBox2,
                                        IntTools_SequenceOfRanges& theRanges1,
                                        IntTools_SequenceOfRanges& theRanges2)
Looking for the solutions of the intersection between edges with greater precision.

Test cases for the issue.
2014-10-30 13:49:30 +03:00
apn
1ccc9700f8 0024404: The function BRepTools::UVBounds gives wrong result for the face
Added test case bugs/modalg_5/bug24404
2014-10-30 13:46:45 +03:00
apn
2b111fe8ba 0022829: Incorrect result of boolean Fuse operation
Added test case bugs/modalg_5/bug22829
2014-10-30 13:45:05 +03:00
aml
db91484119 0025368: BREPExtrma DistShapeShape gives wrong result for Sphere and Line
Changed analytical Sphere/Line and Cylinder/Line extrema algorithms. Now they search perpendicular and intersection points.
Test cases added.
2014-10-30 13:43:04 +03:00
nbv
02effd356b 0025292: Face/Face intersection algorithm gives different results for different order of the arguments
Method of adjusting was corrected.

Test cases for issue CR25292
2014-10-30 13:25:45 +03:00
pkv
b858a6984e 0025184: Non-deterministic order of wires in the result of General Fuse
The source is brought in line with the current version

Test case for issue CR25184
2014-10-30 13:19:31 +03:00
apn
32c3693332 0022872: BRepClass3d_SolidClassifier::PerformInfinitePoint fails
Added test case bugs/modalg_5/bug22872
2014-10-30 13:05:31 +03:00
apn
6e953e43f6 0024746: Bug in BRepAlgoAPI
Added test case bugs/modalg_5/bug24746
2014-10-30 12:59:35 +03:00
apn
3798da68bc 0021898: Empty result of intersection between a surface of revolution and a line
Added test case bugs/modalg_5/bug21898
2014-10-30 12:58:51 +03:00
mkv
2da38dd24c 0025354: Intersection operation
Update dimensions tcl sample due to new order of edges after explode.
2014-10-30 12:58:05 +03:00
vro
fcc61cc4c9 0025405: STL reader doesn't keep shared nodes
An improved RWSTL::ReadFile() method + a draw-command returning the number of nodes and triangles for a MeshVS_Mesh object based on STL mesh data source.

An indexed map of points is replaced by a CellFilter of XYZ objects already implemented in BRepBuilderAPI.
Also, BRepBuilderAPI_VertexInspector became exported for TKTopAlgo library (Standard_EXPORT is added for the methods of this class).

Standard_EXPORT is removed for in-line methods of BRepBuilderAPI_VertexInspector

Test-case for issue #25405

Update of test-cases, according to new behavior
2014-10-30 12:19:36 +03:00
ski
4084fb643c 0025387: Error appears during export to STEP operation in ImportExport MFC sample
Combo-box for selection of translation mode is available in Export to STEP and CSFDB files.
Default valuer for STEP export mode is set to As Is, i.e. automatic selection.

Added #define in function CFileDialog because it takes only 6 parameters in Visual Studio 2005.
2014-10-30 12:12:56 +03:00
apn
db4d439c8f 0023249: BRepFeat_SplitShape could not split a simple face by edge
Added test case bugs/modalg_5/bug23249
2014-10-30 12:10:34 +03:00
aml
1eaf1cc1dc 0025380: Intersection curve cannot reach boundary of surface
Changed next point computation in IntWalk_PWalker.cxx.
Now trying to walk over another isoline if new point is too close to previous.

Test case for issue CR25380
2014-10-30 12:05:56 +03:00
pdn
e1aa24d84b 0025424: Performance regression on step import
Regression was caused by checking of shell closeness on each face add iteration. Fixed.

Test case for issue CR25424
2014-10-30 12:00:28 +03:00
san
a0c202521d 0025400: Visualization, TKOpenGl - Structure disappears if assigned a non-default Z layer
- BVH tree in the target Z layer was not updated when OpenGl_Structure
was moved to another Z layer.
- vpriority DRAW command added to test how BVH tree is updated when
display priority is changed
- Test case for Z layers and display priorities added

Handle -noupdate argument within vpriority command
2014-10-30 11:58:22 +03:00
aml
032d027214 0025407: Exception in extrema operation.
Special handling of curve / surface of extrusion case is deleted.
Corresponding test case fixed.

Test cases for issue CR25407
2014-10-30 11:46:34 +03:00
dbp
50d0e1cefd 0025414: Visualization - Optimize ray-tracing performance
This patch increases ray-tracing performance up to 12% in regular mode, and up to 36% in FSAA mode.
2014-10-30 11:44:37 +03:00
pkv
67e36f0c7a 0025408: Wrong result obtained by General Fuse operator.
Changes:

class BOPTools_AlgoTools2D
        method:
    void BOPTools_AlgoTools2D::AdjustPCurveOnFace
      (const TopoDS_Face& aF,
       const Standard_Real aFirst,
       const Standard_Real aLast,
       const Handle(Geom2d_Curve)& aC2D,
       Handle(Geom2d_Curve)& aC2DA)

The location of 2D-curve is adjusted to face boubaries if necessary
using the precision value in parametric space

Unnecessary comments are removed

Test case for issue CR25408
2014-10-30 11:43:34 +03:00
aba
1c9d151726 0025403: Wrong storage of model units in AIS_AngleDimension: corrected AIS_Drawer model units setters; added parameters to vdimensin and vdimparam commands. 2014-10-30 11:40:24 +03:00
vro
09f5e48e01 0025397: Iteration on a tree of nodes is too slow
Added "const Handle(TDataStd_TreeNode)&" for the method TDataStd_ChildNodeIterator::Value().
2014-10-30 11:34:56 +03:00
bugmaster
28746337be Update of testing cases after integration fixes for issue 25354 and 25406 2014-10-24 15:35:41 +04:00
kgv
afbdee68fa 0025417: Visualization, OpenGl_Context - fix preprocessor check to load GL functions on OS X 2014-10-24 11:18:52 +04:00
kgv
5e6a855aa9 0025411: BVH package - eliminate warning about hidden overloaded method ::Box
Correction of merge error

Fix for compilation
2014-10-24 11:11:38 +04:00
nbv
9256a43d09 0025374: [6.8.0beta regression] gp_Trsf2d::SetMirror() looses transformation form
1. Elements of gp_TrsfForm have been documented
2. gp_Trsf2d class has been reverted to non-regression case.

Update of test-cases
2014-10-24 10:53:44 +04:00
vro
7a13ab2df1 0025361: Sample "Voxel" crashes during "Demo - Collisions" demonstration
Deletion of an array was incorrect.
2014-10-23 16:26:59 +04:00
vro
ac730776d8 0025352: Analytical calculation of fillets 2d: an improvement of precision
Already calculated points of the fillet are used instead of getting of the points on curve by a parameter.
2014-10-23 16:24:48 +04:00
jgv
903f7584b8 0025406: BRepOffset_MakeOffset algorithm fails on the face with two degenerated edges on u-iso null curves
Test cases for issue CR25406
2014-10-23 16:20:56 +04:00
apn
09c597c998 0025244: CMake building procedure should support VTK usage
Added functionality for searching VTK products.

Added procedure install for VTK.
2014-10-23 16:20:55 +04:00
pkv
8591531065 0025354: Intersection operation
I. New features:
I.1 class BOPAlgo_Section
     The class clontains the algorithm to build a result of Secton between the arguments.
     The result of Section consists of vertices and edges.
     The result of Section contains:
     1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
     2. vertices that are subjects of V/E, V/F interferences
     3. new edges that are subjects of F/F interferences
     4. edges that are Common Blocks
     5.a vertex is included in result of Section only when it is not shared
     between the edges of the result of Section

The class BOPAlgo_Section inherits the functionality of root class BOPAlgo_Builder

1.2 class BOPTest_Objects
method:
BOPAlgo_Section& BOPTest_Objects::Section()
has been added to get access to BOPAlgo_Section object

II. Changes:
II.1. class BOPAlgo_BOP
method:
void BOPAlgo_BOP::BuildSection()
has been removed
methods:
void BOPAlgo_BOP::CheckData()
void BOPAlgo_BOP::Prepare()
void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
const TopTools_ListOfShape& BOPAlgo_BOP::Generated
  (const TopoDS_Shape& theS)
have been modified to eliminate references on Section operation

II.2. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::UpdateFaceInfo
  (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
modified to prevent the usage of negative index in Data Structure

II.3. class BOPTest_Objects
static function:
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
has been modified to use BOPAlgo_Section object instead of BOPAlgo_BOP object

static function:
Standard_Integer bbop(Draw_Interpretor& di,
                      Standard_Integer n,
                      const char** a)
has been modified to use BOPAlgo_Section object instea of BOPAlgo_BOP object

II.4. class BRepAlgoAPI_BooleanOperation
field:
myBuilder
the type has been changed from BOPAlgo_BOP* to BOPAlgo_Builder*
method:
void BRepAlgoAPI_BooleanOperation::Build()
has been modified  to use BOPAlgo_Section object

II.5. class QANewModTopOpe_Tools
method:
Standard_Boolean QANewModTopOpe_Tools::HasSameDomain(
                                                   const BOPAlgo_PBOP& theBuilder,
                                                     const TopoDS_Shape& theFace)

void QANewModTopOpe_Tools::SameDomain(
                                      const BOPAlgo_PBOP&   theBuilder,
                                      const TopoDS_Shape&   theFace,
                                      TopTools_ListOfShape& theResultList)

the type of the parameter <theBuilder> has been modified
to use BOPAlgo_Builder* instead of BOPAlgo_BOP*

II.6. The method:
const TopTools_ListOfShape& BOPAlgo_BOP::Generated
  (const TopoDS_Shape& theS)
has been removed
2014-10-23 16:20:54 +04:00
kgv
905428003c 0025412: BRepMesh_FastDiscretFace::tryToInsertAnalyticVertex() - fix invalid comparison
Remove unused field BRepMesh_FastDiscretFace::myWithShare.
Remove "virtual" from method of class <anonymous>::FixedVExplorer.
2014-10-23 16:20:52 +04:00
kgv
7c58a2abc0 0025411: BVH package - eliminate warning about hidden overloaded method ::Box
Conflicts:
	src/OpenGl/OpenGl_SceneGeometry.hxx
2014-10-23 16:20:51 +04:00
msv
75827e7628 0025396: Crash occurs when using TBB allocator on an Intel architecture not supporting SSE2 instructions
During initialization of memory manager, check if SSE2 instructions are supported, when MMGT_OPT=2 is in effect. If not then use MMgrRaw instead of MMgrTBBalloc. It is to avoid runtime crash when running on a CPU that supports SSE but does not support SSE2 (some modifications of AMD Sempron).

Fix broken compilation on MSVC for x64 platform

Correct the last fix.
2014-10-23 16:20:50 +04:00
dbp
3fb72902ea 0025349: Graphic3d_MaterialAspect::Color() returns a value different from that set by the method Graphic3d_MaterialAspect::SetColor
Fix bug with default color of clip plane.
2014-10-23 16:20:49 +04:00
apn
876d1f2a2c 0022196: Problem with puting texture on the bottle.brep shape
Test case bugs/modalg_2/bug22196 was modified to apply texture.
2014-10-23 16:20:48 +04:00
apn
0cc44c4730 0023911: Invalid output of command Xdump
Improved output of Xdump command using Draw_Interpretor.

Improved output of Xdump command using Standard_SStream.

OStream is used instead of SStream.

Test cases for issue CR23911
2014-10-23 16:20:47 +04:00
san
e21b2bc603 0025399: Visualization - XCAFPrs_AISObject ignores global aspect settings
Copying of the default drawer's parameters added.
2014-10-23 16:20:46 +04:00
abv
3415763e74 0025401: Some warnings could be eliminated
Do not redefine macro "strcasecmp" on Windows (MSVC) if it is already defined.
Some useless declarations and comments removed.
2014-10-23 16:20:46 +04:00
jgv
0e0f7a7cde 0025334: BRepOffsetAPI_MakeOffset algorithm crashes on some customer's shape
Test cases for issue CR25334
2014-10-23 16:20:45 +04:00
kgv
ba9e14dfb9 0025373: Visualization, AIS_MultipleConnectedInteractive - transformation persistence flags are ignored for connected objects
Provide method AIS_MultipleConnectedInteractive::Connect() taking transformation persistence flags.
Copy transformation persistence flags from original objects when called Connect() without extra arguments.
2014-10-23 16:20:43 +04:00
msv
191082ac71 0025344: Draw variables do not follow the scope of TCL level
Use NCollection_Map instead of instantiation of TCollection_Map

Test-cases for issue #25344

Correct error in test script: the shape variable assigned by the command 'restore' must not be referred by '$'.
2014-10-23 16:20:42 +04:00
kgv
a69a08ee9e 0025294: Visualization, PrsMgr_Presentation - detach connected presentations on destruction 2014-10-23 16:20:41 +04:00
msv
5e452c37ee 0025348: Method Assign of NCollection containers must not change own allocator of the target
Correct according to remarks of reviewer:
- Assign() and operator=() should implement equal approach to allocators
- Protect all collections against assignment to itself with operator=()

Test-case for issue #25348
2014-10-23 16:20:40 +04:00
kgv
86766b0ee0 0025381: Visualization - XCAFPrs_AISObject ignores visibility flag for sub-shapes
Test case for issue CR25381
2014-10-23 16:20:39 +04:00
apl
bc67757515 0024965: Problem in local selection mode with selected objects staying in the viewer
Added method to clear outdated selection of entity owners on recompute (update) of selection.
Added test case to check selection behavior in local context.

Cosmetic corrections
2014-10-23 16:20:38 +04:00
kgv
40f70ac929 0025371: Visualization - raise exception in AIS_ConnectedInteractive::Connect() on invalid argument
Indicate API misuse by program exception.
2014-10-23 16:20:37 +04:00
dbp
25ef750e44 025306: Visualization, TKOpenGl - support texturing within RayTracing
Fix bug with overlay OpenGL text.
2014-10-23 16:20:36 +04:00
aml
f82a9555dc 0025376: Inconsistence between function and derivatives evaluation in Extrema_GlobOptFuncCS.
Changed "value" function behavior in Extrema/Extrema_GlobOptFuncCS.cxx. Now it compute square distance between point on curve and point on surface.

Fixed description in Extrema_GlobOptFuncCC.
2014-10-23 16:20:35 +04:00
osa
ed06327034 0025332: Visualization - rewrite MinMaxValues methods to using of Bnd_Box 2014-10-23 16:20:34 +04:00
apn
e1cbc34c5f 0023698: BRepBuilderAPI_Copy creates invalid copy
Added test case bugs/modalg_5/bug23698
2014-10-23 14:00:26 +04:00
isz
196b01482b 0025359: In Draw Test Harness: content of menu-items "Curves" and "Surfaces" is increased after each sample launching
Menus "Curves" and "Surfaces" are destroyed now (if they exist) before displaying.
2014-10-23 13:58:48 +04:00
apl
ba4feb7629 0025265: Perspective projection - selecting front point of two 2014-10-23 13:23:30 +04:00
abv
0644bfa483 Fix compilation without TBB (VC9) 2014-10-17 16:58:48 +04:00
mkv
4292bee12a Correction of testing cases 2014-10-17 16:40:22 +04:00
bugmaster
83a8694888 Eliminating of warning 2014-10-17 16:38:33 +04:00
abv
aefdc31bf0 0025266: Debug statements in the source are getting flushed on to the console
Suppress remaining couts in packages explicitly mentioned in the original bug description

Correction of test cases for issue CR25266
2014-10-16 16:45:55 +04:00
apn
a520f6eb9a 0025313: Review of TODOs in test cases for unused platforms
TODOs for unused platforms were deleted. Issue 22988 was closed.
2014-10-16 16:45:27 +04:00
nbv
9e20ed5793 0023547: Tests failures in debug mode
1. DRAW-commands for curve/surface continuity returning were changed.
2. Output of "distmini" DRAW-command is amended.
3. Function MinMax() was moved from Standard_Real to IntPatch_ImpImpIntersection_4.gxx.
4. Incorrect computing of nbcurveC1 in Geom2dConvert::C0BSplineToC1BSplineCurve(...) function was liquidated.

Test cases were changed.
2014-10-16 16:45:13 +04:00
dbv
63c629aa3a 0025266: Debug statements in the source are getting flushed on to the console
Output to cout activated previously in Debug mode by #ifdef DEB is suppressed by using macro <PACKAGE>_DEB instead of DEB
2014-10-16 16:44:56 +04:00
kgv
7aa1b65c2a 0025369: Visualization, Image_AlienPixMap - handle UTF-8 names in image read/save operations on Windows
Test-case for issue #25369
2014-10-16 16:14:06 +04:00
kgv
54a16ee447 0025340: Visualization, AIS_InteractiveContext - properly apply selection filters at Neutral point
Do not use myMainSel->OnePicked() in AIS_InteractiveContext::MoveTo().

Test-case for issue #25340
2014-10-16 16:08:27 +04:00
nbv
058f130eff 0025100: Self-intersection of surfaces with using GeomAPI_IntSS rises run-time check failure
1. Bug command added.
2. Dynamic array is used in place of static.
2014-10-16 15:58:19 +04:00
kgv
01d5be80b8 0025370: Visualization - misprint in PrsMgr_PresentationManager::Connect()
fix theMode -> theOtherMode
2014-10-16 15:50:42 +04:00
san
6d17debbe9 0025383: Broken vrecord command
Pass HWND of the current 3D view to OpenGl_AVIWriter::StartRecording()
in order to make it work.
2014-10-16 15:46:36 +04:00
abv
94dea18e8b 0025365: Regressions after changes in IsClosed flag
Restore previous behavior of BRep_Tool::IsClosed() for shells: empty shells and shells containing only INTERNAL or EXTERNAL sub-shapes are considered non-closed.
2014-10-16 15:43:55 +04:00
apl
6262a3032c 0025363: Visualization - add test command for V3d_View::FitAll by view area 2014-10-16 15:38:44 +04:00
dbv
5203f74183 0021802: Not all names are transferred from STEP to IGES via XDE
Method IGESCAFControl_Writer::WriteNames now iterates over all nested assemblies and collects names for shapes.
Regression fix
Test-case for issue #21802
2014-10-16 15:36:14 +04:00
emv
4691b61a72 0025319: Bop Common produces strange results with same shapes.
class BOPAlgo_Builder
method
  void BOPAlgo_Builder::FillIn3DParts
    (BOPCol_DataMapOfShapeListOfShape& theInParts,
     BOPCol_DataMapOfShapeShape& theDraftSolids,
     const BOPCol_BaseAllocator&)
Sort faces before its classification relatively to the solid.

Test cases for issue CR25319

Correction of test cases for issue CR25319
2014-10-16 15:31:11 +04:00
emv
2a2e3ecdc7 0025245: General Fuse operation regression
class BOPDS_DS
method:
  void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
Correct treatment of internal edges.

Test cases for the issue.

Correction of test cases for issue CR25245
2014-10-16 15:27:31 +04:00
emv
d46546cdcd 0023753: Test case bugs modalg_2 bug19793_2 works too long on Linux platform
class IntTools_ShrunkRange
method void IntTools_ShrunkRange::Perform()
Fix to avoid creation of small section edges.

Correction of test case for issue CR23753
2014-10-16 15:15:13 +04:00
osa
f0ecc0cc24 0025358: Visualization - method V3d_View::Reset has incorrect condition for update 2014-10-16 15:10:04 +04:00
kgv
5b37e9d143 0025366: Method AIS_MultipleConnectedInteractive::AcceptShapeDecomposition() should be exported 2014-10-16 15:04:31 +04:00
vro
8e1e79f052 0025317: Failure on attempt to save an Ocaf document with a long double array attribute in a Xml file
A draw-command SetRealArrayValue. It is necessary to reproduce the crash.
A fix + some additional draw-commands
Test cases for issue CR25317
2014-10-16 15:02:30 +04:00
duv
7d9e854bdc 0025276: Visualization - Lighting is broken if some kinds of transformation applied to a shape
In order to solve the problem, triangle vertices order is inverted in
mirrored mesh (triangulation). Mesh considered to be mirrored if its
transformation matrix determinant is less than 0.

To handle AIS object mirror transformations "Mirrored" flag stored in
OpenGl_Structure. If this flag is enabled, glFrontFace (GL_CW) applied
before the draw call.

New DRAW commands for visualization level transformations added.
2014-10-16 14:58:33 +04:00
pdn
c60370656c 0007570: Exception in ShapeFix_Wireframe::FixSmallEdges
Exception fixed by checking if subshape removed completely.

Test-case for issue #7570
2014-10-16 14:26:12 +04:00
kgv
256f9ac0ad 0025303: Visualization, TKOpenGl - dynamically disable unused light sources in generated GLSL program 2014-10-16 13:44:18 +04:00
bugmaster
2c2cebb3f7 Adding dependencies from tbb 2014-10-16 13:26:16 +04:00
1359 changed files with 27513 additions and 11823 deletions

View File

@@ -41,6 +41,7 @@ if (APPLE)
endif()
set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not")
set (USE_VTK OFF CACHE BOOL "Is VTK used or not")
if (NOT DEFINED ANDROID)
set (USE_GL2PS OFF CACHE BOOL "Is gl2ps used or not")
@@ -106,12 +107,6 @@ else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_TK_LIBRARY_DIR")
endif()
# GLX
if (USE_GLX)
add_definitions (-DMACOSX_USE_GLX)
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/glx")
endif()
# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE)
@@ -126,10 +121,21 @@ else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_LIBRARY_DIR")
endif()
# VTK
if (USE_VTK)
add_definitions (-DHAVE_VTK)
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/vtk")
endif()
# GLX
if (USE_GLX)
add_definitions (-DMACOSX_USE_GLX)
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/glx")
endif()
# FREEIMAGE
if (USE_FREEIMAGE)
add_definitions (-DHAVE_FREEIMAGE)
message (STATUS "Info: freeimage is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freeimage")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freeimageplus")
else()
@@ -142,7 +148,6 @@ endif()
# GL2PS
if (USE_GL2PS)
add_definitions (-DHAVE_GL2PS)
message (STATUS "Info: gl2ps is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/gl2ps")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
@@ -152,7 +157,6 @@ endif()
# OPENCL
if (USE_OPENCL)
add_definitions (-DHAVE_OPENCL)
message (STATUS "Info: OpenCL is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/opencl")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
@@ -164,7 +168,6 @@ endif()
# TBB
if (USE_TBB)
ADD_DEFINITIONS(-DHAVE_TBB)
message (STATUS "Info: tbb is used by OCCT")
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/tbb")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")

View File

@@ -8,6 +8,7 @@ if "%VCVER%" == "@COMPILER@" (
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@"
set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIR@"
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
)
)
)

View File

@@ -8,6 +8,7 @@ if [ "$COMPILER" == "@COMPILER@" ]; then
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIR@"
export GL2PS_DIR="@3RDPARTY_GL2PS_LIBRARY_DIR@"
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
fi
fi
fi

View File

@@ -27,6 +27,7 @@ if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
rem ----- Set path to 3rd party and OCCT libraries -----
set "BIN_TAIL=win%ARCH%/%VCVER%/bin%CASDEB%"

View File

@@ -57,6 +57,10 @@ if [ "$TBB_DIR" != "" ]; then
THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
fi
if [ "$VTK_DIR" != "" ]; then
THRDPARTY_PATH="${VTK_DIR}:${THRDPARTY_PATH}"
fi
BIN_PATH="${WOKSTATION}${ARCH}/${COMPILER}/bin${CASDEB}"
LIBS_PATH="${WOKSTATION}${ARCH}/${COMPILER}/lib${CASDEB}"

View File

@@ -312,8 +312,8 @@ if (INSTALL_TCL)
if (TCL_TCLSH_VERSION)
# tcl is required to install in lib folder (without ${BUILD_POSTFIX})
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
else()
message (STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")

156
adm/templates/vtk.cmake Normal file
View File

@@ -0,0 +1,156 @@
# vtk
if (NOT DEFINED INSTALL_VTK)
set (INSTALL_VTK OFF CACHE BOOL "Is vtk required to be copied into install directory")
endif()
# vtk directory
if (NOT DEFINED 3RDPARTY_VTK_DIR)
set (3RDPARTY_VTK_DIR "" CACHE PATH "The directory containing vtk")
endif()
# vtk include directory
if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of vtk")
endif()
# vtk library directory
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing vtk library")
endif()
# vtk dll directory
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
set (3RDPARTY_VTK_DLL_DIR "" CACHE FILEPATH "The directory containing VTK dll")
endif()
# search for vtk in user defined directory
if (NOT 3RDPARTY_VTK_DIR AND 3RDPARTY_DIR)
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" vtk VTK_DIR_NAME)
if (VTK_DIR_NAME)
set (3RDPARTY_VTK_DIR "${3RDPARTY_DIR}/${VTK_DIR_NAME}" CACHE PATH "The directory containing vtk product" FORCE)
endif()
endif()
# find installed vtk
find_package(VTK QUIET)
# find native vtk
if (NOT VTK_FOUND)
find_package(VTK QUIET PATHS "${3RDPARTY_VTK_DIR}")
endif()
if (NOT VTK_FOUND AND NOT 3RDPARTY_VTK_DIR OR NOT EXISTS "${3RDPARTY_VTK_DIR}")
message(SEND_ERROR "VTK not found. Set the 3RDPARTY_VTK_DIR cmake cache entry to the directory containing VTK.")
set (3RDPARTY_VTK_DIR "3RDPARTY_VTK_DIR-NOTFOUND" CACHE PATH "The directory containing vtk product" FORCE)
endif()
OCCT_MAKE_BUILD_POSTFIX()
set(VTK_VERSION "")
if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
get_filename_component(3RDPARTY_VTK_DIR_NAME "${3RDPARTY_VTK_DIR}" NAME)
string(REGEX MATCH "^VTK-([0-9].[0-9])" VTK_VERSION "${3RDPARTY_VTK_DIR_NAME}")
set(VTK_VERSION "${CMAKE_MATCH_1}")
if (NOT 3RDPARTY_VTK_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_DIR}/include/vtk-${VTK_VERSION}" CACHE FILEPATH "The directory containing includes of VTK" FORCE)
endif()
if (NOT 3RDPARTY_VTK_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
if(EXISTS "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}")
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
else()
if (NOT "${BUILD_POSTFIX}" STREQUAL "" AND EXISTS "${3RDPARTY_VTK_DIR}/lib")
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
endif()
endif()
endif()
if(3RDPARTY_VTK_LIBRARY_DIR)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_VTK_LIBRARY_DIR}")
endif()
endif()
# vtk libraries
# lib
set (VTK_LIBRARY_NAMES vtkCommonCore-${VTK_VERSION}.lib vtkCommonDataModel-${VTK_VERSION}.lib vtkCommonExecutionModel-${VTK_VERSION}.lib
vtkCommonMath-${VTK_VERSION}.lib vtkCommonTransforms-${VTK_VERSION}.lib vtkRenderingCore-${VTK_VERSION}.lib
vtkRenderingOpenGL-${VTK_VERSION}.lib vtkFiltersGeneral-${VTK_VERSION}.lib vtkIOCore-${VTK_VERSION}.lib
vtkIOImage-${VTK_VERSION}.lib vtkImagingCore-${VTK_VERSION}.lib vtkInteractionStyle-${VTK_VERSION}.lib )
#dll
set (VTK_DLL_NAMES vtkCommonComputationalGeometry-${VTK_VERSION}.dll
vtkCommonCore-${VTK_VERSION}.dll
vtkCommonDataModel-${VTK_VERSION}.dll
vtkCommonExecutionModel-${VTK_VERSION}.dll
vtkCommonMath-${VTK_VERSION}.dll
vtkCommonMisc-${VTK_VERSION}.dll
vtkCommonSystem-${VTK_VERSION}.dll
vtkCommonTransforms-${VTK_VERSION}.dll
vtkDICOMParser-${VTK_VERSION}.dll
vtkFiltersCore-${VTK_VERSION}.dll
vtkFiltersExtraction-${VTK_VERSION}.dll
vtkFiltersGeneral-${VTK_VERSION}.dll
vtkFiltersGeometry-${VTK_VERSION}.dll
vtkFiltersSources-${VTK_VERSION}.dll
vtkFiltersStatistics-${VTK_VERSION}.dll
vtkIOCore-${VTK_VERSION}.dll
vtkIOImage-${VTK_VERSION}.dll
vtkImagingCore-${VTK_VERSION}.dll
vtkImagingFourier-${VTK_VERSION}.dll
vtkImagingHybrid-${VTK_VERSION}.dll
vtkInteractionStyle-${VTK_VERSION}.dll
vtkRenderingCore-${VTK_VERSION}.dll
vtkRenderingOpenGL-${VTK_VERSION}.dll
vtkalglib-${VTK_VERSION}.dll
vtkjpeg-${VTK_VERSION}.dll
vtkmetaio-${VTK_VERSION}.dll
vtkpng-${VTK_VERSION}.dll
vtksys-${VTK_VERSION}.dll
vtktiff-${VTK_VERSION}.dll
vtkzlib-${VTK_VERSION}.dll )
# search for dll directory
if (WIN32)
if (NOT 3RDPARTY_VTK_DLL_DIR OR NOT EXISTS "${3RDPARTY_VTK_DLL_DIR}")
if(EXISTS "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}")
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
else()
if (NOT "${BUILD_POSTFIX}" STREQUAL "" AND EXISTS "${3RDPARTY_VTK_DIR}/bin")
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
endif()
endif()
endif()
endif()
OCCT_CHECK_AND_UNSET(VTK_DIR)
if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_VTK_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
endif()
if (INSTALL_VTK)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if(3RDPARTY_VTK_DLL_DIR AND EXISTS "${3RDPARTY_VTK_DLL_DIR}")
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
set (3RDPARTY_VTK_DLL "3RDPARTY_VTK_DLL-NOTFOUND" CACHE FILEPATH "VTK shared library" FORCE)
find_library(3RDPARTY_VTK_DLL "${VTK_DLL_NAME}" PATHS "${3RDPARTY_VTK_DLL_DIR}" NO_DEFAULT_PATH)
if (NOT 3RDPARTY_VTK_DLL OR NOT EXISTS "${3RDPARTY_VTK_DLL}")
list (APPEND 3RDPARTY_NOT_INCLUDED "${3RDPARTY_VTK_DLL}")
else()
install (FILES ${3RDPARTY_VTK_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
endif()
endforeach()
OCCT_CHECK_AND_UNSET(3RDPARTY_VTK_DLL)
endif()
else ()
foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
string(REPLACE ".dll" ".so.1" VTK_DLL_NAME "${VTK_DLL_NAME}")
install(FILES "${3RDPARTY_VTK_LIBRARY_DIR}/lib${VTK_DLL_NAME}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME "lib${VTK_DLL_NAME}")
endforeach()
endif()
endif()
mark_as_advanced (VTK_INCLUDE_DIRS VTK_LIBRARY_DIRS VTK_DIR)

View File

@@ -11,6 +11,9 @@ overview/overview.md
../samples/CSharp/ReadMe.md
../samples/CSharp/ReadMe_D3D.md
../samples/qt/AndroidQt/ReadMe.md
../samples/java/jniviewer/ReadMe.md
tutorial/tutorial.md
technical_overview/technical_overview.md
@@ -27,7 +30,7 @@ user_guides/step/step.md
user_guides/xde/xde.md
user_guides/ocaf/ocaf.md
user_guides/tobj/tobj.md
user_guides/draw_test_harness.md
user_guides/draw_test_harness/draw_test_harness.md
user_guides/brep_wp/brep_wp.md
user_guides/ocaf_functionmechanism_wp/ocaf_functionmechanism_wp.md
user_guides/ocaf_tree_wp/ocaf_tree_wp.md

View File

@@ -16,7 +16,7 @@ user_guides/ocaf_functionmechanism_wp/ocaf_functionmechanism_wp.md
user_guides/ocaf_tree_wp/ocaf_tree_wp.md
user_guides/ocaf_wp/ocaf_wp.md
user_guides/step/step.md
user_guides/draw_test_harness.md
user_guides/draw_test_harness/draw_test_harness.md
user_guides/tobj/tobj.md
user_guides/visualization/visualization.md
user_guides/voxels_wp/voxels_wp.md

View File

@@ -16,11 +16,12 @@ There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;  
* FreeType 2.4.10 - 2.4.11;
* FreeType 2.4.10 - 2.5.3;
* Optional products:
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 - 3.15.4.
* FreeImage 3.14.1 - 3.16.0;
* VTK 6.1.0.
@section dev_guides__building_3rdparty_linux_2 Building Mandatory Third-party Products
@@ -104,7 +105,7 @@ Download the necessary archive from http://sourceforge.net/projects/freetype/fil
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from http://threadingbuildingblocks.org.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product.
@subsection dev_guides__building_3rdparty_linux_3_2 gl2ps
@@ -195,56 +196,49 @@ and unpack it. The directory with unpacked sources is further referred to as *F
make DESTDIR=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files
make clean
@subsection dev_guides__building_3rdparty_linux_3_4 OpenCL ICD Loader
make clean
If you have OpenCL SDK (one provided by Apple, AMD, NVIDIA, Intel, or other
vendor) installed on your system, you should find OpenCL headers and
libraries required for building OCCT inside that SDK.
@subsection dev_guides__building_3rdparty_linux_3_4 VTK
Alternatively, you can use OpenCL ICD (Installable Client Driver) Loader
provided by Khronos group. The following describes steps used to build OpenCL
ICD Loader version 1.2.11.0.
You can download VTK sources from http://www.vtk.org/VTK/resources/software.html
1. Download OpenCL ICD Loader sources archive and OpenCL header files from
Khronos OpenCL Registry
http://www.khronos.org/registry/cl/
### The building procedure:
2. Unpack the archive and put headers in *inc/CL* sub-folder
Download the necessary archive from http://www.vtk.org/VTK/resources/software.html and unpack it.
3. Print *make* in the root of the unpacked archive to compile OpenCL libraries.
1. Install or build *cmake* product from the source file.
2. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located:
4. Create installation folder for OpenCL IDL Loader package and put there:
ccmake VTK_SRC_DIR
1. OpenCL header files in *include/CL* subfolder
* Press <i>[c]</i> to make the initial configuration
* Define the necessary options in *VTK_INSTALL_PREFIX*
* Press <i>[c]</i> to make the final configuration
* Press <i>[g]</i> to generate Makefile and exit
2. *libOpenCL.so* (generated in *bin* subfolder of source package) in *lib* subfolder
3. Start the building of VTK:
make
4. Start the installation of gl2ps. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
make install
@section dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
@subsection dev_guides__building_3rdparty_linux_4_1 Debian-based distributives
All 3rd-party products required for building of OCCT could be installed
from official repositories. You may install them from console using apt-get utility:
All 3rd-party products required for building of OCCT could be installed
from official repositories. You may install them from console using apt-get utility:
sudo apt-get install \
tcllib tklib tcl-dev tk-dev \
libfreetype-dev \
libxt-dev libxmu-dev \
libgl1-mesa-dev \
libfreeimage-dev \
libtbb-dev \
libgl2ps-dev
To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:
sudo apt-get install \
csh \
libstdc++5:i386 libxt6:i386
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev libgl2ps-dev
Building is possible with any C++ compliant compiler :
sudo apt-get install \
g++
To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:
# you may need to add i386 if not done already by command "dpkg --add-architecture i386"
sudo apt-get install csh libstdc++6:i386 libxt6:i386 libxext6:i386 libxmu6:i386
Building is possible with C++ compliant compiler:
sudo apt-get install g++

View File

@@ -14,13 +14,12 @@ http://www.opencascade.org/getocc/require/</a>.
There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl 8.5,
* Tk 8.5,
* FreeType 2.4.10
* Tcl/Tk 8.5 - 8.6;
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x or 4.x,
* gl2ps 1.3.5,
* FreeImage 3.14.1 or 3.15.x
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 - 3.16.0
@section dev_guides__building_3rdparty_osx_2 Building Mandatory Third-party Products

View File

@@ -12,11 +12,12 @@ The links for downloading the third-party products are available on the web site
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;
* FreeType 2.4.10 - 2.4.11.
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x - 4.x;
* gl2ps 1.3.5 - 1.3.8;
* FreeImage 3.14.1 -3.15.4.
* FreeImage 3.14.1 -3.16.0;
* VTK 6.1.0.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, *c:\\occ3rdparty*).
@@ -299,35 +300,22 @@ http://sourceforge.net/projects/freeimage/files/Source%20Distribution/
As a result, you should have the library files of FreeImage product in *freeimage\\Dist* folder (*FreeImage.dll* and *FreeImage.lib*) and in *freeimage\\Wrapper\\FreeImagePlus\\dist* folder (*FreeImagePlus.dll* and *FreeImagePlus.lib*).
@subsection dev_guides__building_3rdparty_win_opencl OpenCL ICD Loader
@subsection dev_guides__building_3rdparty_win_3_4 VTK
If you have OpenCL SDK (one provided by Apple, AMD, NVIDIA, Intel, or other
vendor) installed on your system, you should find OpenCL headers and
libraries required for building OCCT inside that SDK.
VTK is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
Alternatively, you can use OpenCL ICD (Installable Client Driver) Loader
provided by Khronos group. The following describes steps used to build OpenCL
ICD Loader version 1.2.11.0.
### The building procedure:
1. Download OpenCL ICD Loader sources archive and OpenCL header files from
Khronos OpenCL Registry
http://www.khronos.org/registry/cl/
1. Download the necessary archive from http://www.vtk.org/VTK/resources/software.html and unpack it into *3rdparty* folder.
2. Unpack the archive and put headers in *inc/CL* sub-folder
As a result, you will get a folder named, for example, <i>3rdparty\VTK-6.1.0.</i>
3. Use CMake to generate VS projects for building the library:
- Start CMake-GUI and select OpenCL ICD Loader folder as source path, and the folder of your choice for VS project and intermediate build data;
- Click **Generate**;
- Select the VS version to be used from the ones you have installed (we recommend using VS 2010) and the architecture (32- or 64-bit).
Further in this document, this folder is referred to as *VTK*.
4. Open solution *OPENCL_ICD_LOADER.sln* generated in the build folder.
Though not strictly necessary, we recommend making two changes in the generated projects:
- Add file *OpenCL.rc* to project OpenCL, to have version and Khronos copyright correctly embedded in DLL;
- Change **Runtime library** to **Multi-threaded(/MT)** in the properties of OpenCL project, on **C/C++ / Code Generation** page for Release configuration, to avoid dependency on run-time DLL.
5. Build project OpenCL in Release mode
2. Use CMake to generate VS projects for building the library:
- Start CMake-GUI and select VTK folder as source path, and the folder of your choice for VS project and intermediate build data.
- Click **Configure**.
- Select the VS version to be used from the ones you have installed (we recommend using VS 2010) and the architecture (32 or 64-bit).
- Generate VS projects with default CMake options. The open solution *VTK.sln* will be generated in the build folder.
6. Create the installation folder for OpenCL IDL Loader package and put there:
- OpenCL header files in *include/CL* subfolder;
- *OpenCL.dll* (generated in *bin/Release* subfolder of the source package) in *bin* subfolder;
- *OpenCL.lib* (generated in *Release* subfolder of the build directory) in *lib* subfolder.
3. Build project VTK in Release mode.

View File

@@ -46,13 +46,13 @@ To prevent this, it is suggested to make links:
* <i> --with-freeimage= </i> defines the location of installed **FreeImage** product;
* <i> --with-tbb-include= </i> defines the location of *tbb.h*;
* <i> --with-tbb-library= </i> defines the location of *libtbb.so*;
* <i> --with-opencl-include= </i> defines the location of *cl.h*;
* <i> --with-opencl-library= </i> defines the location of *libOpenCL.so*;
* <i> --with-vtk-include= </i> defines the location of VTK includes;
* <i> --with-vtk-library= </i> defines the location of VTK libraries;
* <i> --enable-debug= yes: </i> includes debug information, no: does not include debug information;
* <i> --enable-production= yes: </i> switches code optimization, no: switches off code optimization;
* <i> --disable-draw </i> allows OCCT building without Draw.
If location of **FreeImage, TBB, gl2ps** or **OpenCL** is not specified, OCCT will be built without these optional libraries.
If location of **FreeImage, TBB, gl2ps** or **VTK** is not specified, OCCT will be built without these optional libraries.
Attention: 64-bit platforms are detected automatically.
@@ -60,7 +60,7 @@ To prevent this, it is suggested to make links:
Example:
\> ./configure -prefix=/PRODUCTS/occt-6.5.5 --with-tcl=/PRODUCTS/tcltk-8.5.8/lib --with-tk=/PRODUCTS/tcltk-8.5.8/lib --with-freetype=/PRODUCTS/freetype-2.4.10 --with-gl2ps=/PRODUCTS/gl2ps-1.3.5 --with-freeimage=/PRODUCTS/freeimage-3.14.1 --with-tbb-include=/PRODUCTS/tbb30_018oss/include --with-tbb-library=/PRODUCTS/tbb30_018oss/lib/ia32/cc4.1.0_libc2.4_kernel2.6.16.21 --with-opencl-include=/PRODUCTS/opencl-icd-1.2.11.0/include --with-opencl-library=/PRODUCTS/opencl-icd-1.2.11.0/lib
\> ./configure -prefix=/PRODUCTS/occt-6.5.5 --with-tcl=/PRODUCTS/tcltk-8.5.8/lib --with-tk=/PRODUCTS/tcltk-8.5.8/lib --with-freetype=/PRODUCTS/freetype-2.4.10 --with-gl2ps=/PRODUCTS/gl2ps-1.3.5 --with-freeimage=/PRODUCTS/freeimage-3.14.1 --with-tbb-include=/PRODUCTS/tbb30_018oss/include --with-tbb-library=/PRODUCTS/tbb30_018oss/lib/ia32/cc4.1.0_libc2.4_kernel2.6.16.21 -with-vtk-include=/PRODUCTS/VTK-6.1.0/include/vtk-6.1 with-vtk-library=/PRODUCTS/ /VTK-6.1.0//lib
3.If configure exits successfully, you can build OCCT with *make* command.

View File

@@ -28,4 +28,8 @@ paragraph 1 of \ref occt_dev_guides__building for instructions.
3. Build with Visual Studio
Note: If VTK was not installed on you computer and you are not interested in usage of
OCCT VTK Integration Services (VIS) component you should exclude TKIVtk and TKIVtkDraw
projects from process of compilation in the main menu <b>Build / Configuration Manager</b>.
To start DRAW, launch *draw.bat*.

View File

@@ -296,19 +296,19 @@ Each descriptive block should contain at least a function name and purpose descr
See the following example:
~~~~~{.cpp}
// ----------------------------------------------
// =======================================================================
// function : TellMeSmthGood
// purpose : Gives me good news
// ----------------------------------------------
// =======================================================================
void TellMeSmthGood()
{
...
}
// ----------------------------------------------
// =======================================================================
// function : TellMeSmthBad
// purpose : Gives me bad news
// ----------------------------------------------
// =======================================================================
void TellMeSmthBad()
{
...

View File

@@ -3,6 +3,26 @@ Debugging tools and hints {#occt_dev_guides__debug}
@tableofcontents
@section occt_debug_macro Compiler macro to enable extended debug messages
Many OCCT algorithms can produce extended debug messages, usually printed to cout.
These include messages on internal errors and special cases encountered, timing etc.
In OCCT versions prior to 6.8.0 most of these messages were activated by compiler macro *DEB*, enabled by default in debug builds.
Since version 6.8.0 this is disabled by default but can be enabled by defining compiler macro *OCCT_DEBUG*.
To enable this macro on Windows when building with Visual Studio projects, edit file custom.bat and add the line:
set CSF_DEFINES=OCCT_DEBUG
Some algorithms use specific macros for yet more verbose messages, usually started with OCCT_DEBUG_.
These messages can be enabled in the same way, by defining corresponding macro.
Note that some header files are modified when *OCCT_DEBUG* is enabled, hence binaries built with it enabled are not compatible with client code built without this option; this is not intended for production use.
@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_intro Introduction
This manual describes facilities included in OCCT to support debugging, and provides some hints for more efficient debug.
@@ -15,10 +35,6 @@ This feature can be activated by defining environment variable *CSF_DEBUG_BOP*,
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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -117,14 +117,7 @@ implementation of 3D viewer. OpenGL specification is developed by the
Khronos group, http://www.khronos.org/opengl/. OCCT code includes header
file *glext.h* obtained from Khronos web site.
**OpenCL** (Open Computing Language) is open, royalty-free standard for
cross-platform, parallel programming of modern processors, optionally used by
OCCT for ray tracing. OpenCL specification is developed by the
Khronos group, http://www.khronos.org/opencl/. The implementations of OpenCL
are available from Apple, AMD, NVIDIA, Intel, and other vendors.
**OpenCL Installable Client Driver (ICD) Loader** is a library provided by
Khronos group which allows dispatching OpenCL calls to underlying
implementation.
**VTK** - The **Visualization Toolkit (VTK)** is an open-source, freely available software system for 3D computer graphics, image processing and visualization. OCCT VIS component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library. If you need further information on VTK, please, refer to VTK Homepage http://www.vtk.org/.
**Doxygen** developed by Dimitri van Heesch is open source documentation system for
C++, C, Java, Objective-C, Python, IDL, PHP and C#. This product is used in Open CASCADE Technology
@@ -235,12 +228,12 @@ for which OCCT is certified to work.
| Graphic library | OpenGL 1.1+ (OpenGL 2.1+ is recommended)|
| C++ | GNU gcc 4.0. - 4.7.3. |
| TCL (for testing tools) | Tcltk 8.5 or 8.6 http://www.tcl.tk/software/tcltk/download.html |
| Qt (for demonstration tools) | Qt 4.6.2 http://qt-project.org/downloads |
| Freetype (for text rendering) | freetype-2.4.11 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.15.4 http://sourceforge.net/projects/freeimage/files |
| Qt (for demonstration tools) | Qt 4.8.6 http://qt-project.org/downloads |
| Freetype (for text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (optional, for support of common 2D graphic formats) | FreeImage 3.16.0 http://sourceforge.net/projects/freeimage/files |
| gl2ps (optional, for export contents of OCCT viewer to vector graphic files) | gl2ps-1.3.8 http://geuz.org/gl2ps/ |
| Intel TBB (optional, for multithreaded algorithms) | TBB 3.x or 4.x http://www.threadingbuildingblocks.org/ |
| OpenCL (optional, for ray tracing visualization) | OpenCL SDK (usually one provided by vendor of your graphic card) or OpenCL ICD Loader by Khronos group, http://www.khronos.org/registry/cl |
| VTK (for VTK Integration Services | VTK 6.1.0 http://www.vtk.org/VTK/resources/software.html |
* Debian 60 64 bit is a platform used for regular testing of contributions
@@ -253,13 +246,13 @@ for which OCCT is certified to work.
| Video card | See \ref overview_req_graphics |
| Graphic library | OpenGL 1.1+ (OpenGL 2.1+ is recommended)|
| C++ | Microsoft Visual Studio: 2005 SP1, 2008 SP1\*, 2010 SP1, 2012 Update 3, 2013 <br>Intel C++ Composer XE 2013 SP1 |
| TCL (for testing tools) | Tcl/Tk 8.5 or 8.6 http://www.tcl/tk/software/tcltk/download.html |
| Qt (for demonstration tools) | Qt 4.6.2 http://qt-project.org/downloads |
| Freetype (OCCT Text rendering) | freetype-2.4.11 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (Support of common graphic formats) | FreeImage 3.15.4 http://sourceforge.net/projects/freeimage/files |
| TCL (for testing tools) | Tcl/Tk 8.5 or 8.6 http://www.tcl.tk/software/tcltk/download.html |
| Qt (for demonstration tools) | Qt 4.8.6 http://qt-project.org/downloads |
| Freetype (OCCT Text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (Support of common graphic formats) | FreeImage 3.16.0 http://sourceforge.net/projects/freeimage/files |
| gl2ps (Export contents of OCCT viewer to vector graphic file) | gl2ps-1.3.8 http://geuz.org/gl2ps/ |
| Intel TBB (optional, for multithreaded algorithms) | TBB 3.x or 4.x http://www.threadingbuildingblocks.org/ |
| OpenCL (optional, for ray tracing visualization) | OpenCL SDK (usually one provided by vendor of your graphic card) or OpenCL ICD Loader by Khronos group, http://www.khronos.org/registry/cl |
| VTK (for VTK Integration Services | VTK 6.1.0 http://www.vtk.org/VTK/resources/software.html |
* VC++ 10 32-bit is used for certification of contributions and for building
binary package of official release of OCCT on Windows.
@@ -274,19 +267,18 @@ for which OCCT is certified to work.
| Graphic library | OpenGL 1.1+ (OpenGL 2.1+ is recommended)|
| C++ | XCode 3.2 or newer (4.x is recommended) |
| TCL (for testing tools) | Tcltk 8.5 or 8.6 http://www.tcl.tk/software/tcltk/download.html |
| Qt (for demonstration tools) | Qt 4.6.2 http://qt-project.org/downloads |
| Freetype (OCCT Text rendering) | freetype-2.4.11 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (Support of common graphic formats) | FreeImage 3.15.4 http://sourceforge.net/projects/freeimage/files |
| Qt (for demonstration tools) | Qt 4.8.6 http://qt-project.org/downloads |
| Freetype (OCCT Text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
| FreeImage (Support of common graphic formats) | FreeImage 3.16.0 http://sourceforge.net/projects/freeimage/files |
| gl2ps (Export contents of OCCT viewer to vector graphic file) | gl2ps-1.3.8 http://geuz.org/gl2ps/ |
| Intel TBB (optional, for multithreaded algorithms) | TBB 3.x or 4.x http://www.threadingbuildingblocks.org/ |
| OpenCL (optional, for ray tracing visualization) | Native OpenCL 1.2.8 |
@subsection OCCT_OVW_SECTION_5_4 Android
| Operating System | Android 4.0.4+ |
| ----- | ----- |
| Minimum memory | 512 MB, 1 GB recommended |
| Freetype (for text rendering) | freetype-2.4.11 http://sourceforge.net/projects/freetype/files/ |
| Freetype (for text rendering) | freetype-2.5.3 http://sourceforge.net/projects/freetype/files/ |
@subsection overview_req_graphics Graphic cards
@@ -319,7 +311,7 @@ building OCCT from sources on supported platforms.
@subsection OCCT_OVW_SECTION_4_1 Using Windows installer
On Windows Open CASCADE Technology can be installed with binaries precompiled by
Visual C++ 2008 with installation procedure.
Visual C++ 2010 with installation procedure.
**Recommendation:**
@@ -345,14 +337,14 @@ When the installation is complete, you will find the directories for 3rd party p
@image html /overview/images/overview_3rdparty.png
@image latex /overview/images/overview_3rdparty.png
The contents of the OCCT-6.7.0 directory (called further "OCCT root", or $CASROOT) are as follows:
The contents of the OCCT-6.8.0 directory (called further "OCCT root", or $CASROOT) are as follows:
@image html /overview/images/overview_installation.png "The directory tree"
@image latex /overview/images/overview_installation.png "The directory tree"
* **adm** This folder contains administration files, which allow rebuilding OCCT;
* **adm/cmake** This folder contains files of CMake building procedure;
* **adm/msvc** This folder contains Visual Studio projects for Visual C++ 2005, 2008 and 2010, which allow rebuilding OCCT under Windows platform in 32 and 64-bit mode;
* **adm/msvc** This folder contains Visual Studio projects for Visual C++ 2005, 2008, 2010, 2012 and 2013 which allow rebuilding OCCT under Windows platform in 32 and 64-bit mode;
* **data** This folder contains CAD files in different formats, which can be used to test the OCCT functionality;
* **doc** This folder contains OCCT documentation in HTML and PDF format;
* **dox** This folder contains sources of OCCT documentation in plain text (MarkDown) format;
@@ -361,7 +353,7 @@ The contents of the OCCT-6.7.0 directory (called further "OCCT root", or $CASROO
* **samples** This folder contains sample applications.
* **src** This folder contains OCCT source files. They are organized in folders, one per development unit;
* **tests** This folder contains scripts for OCCT testing.
* **win32/vc9** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2008;
* **win32/vc10** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2010;
@section OCCT_OVW_SECTION_4_2 Environment Variables
@@ -392,7 +384,6 @@ The scripts are located in the OCCT root folder.
### Description of system variables:
* **CASROOT** is used to define the root directory of Open CASCADE Technology;
* **PATH** is required to define the path to OCCT binaries and 3rdparty folder;
* **LD_LIBRARY_PATH** is required to define the path to OCCT libraries (on UNIX platforms only);
@@ -625,7 +616,20 @@ Export:
See \subpage samples_csharp_occt "Readme" for details.
Also there is an other C# example with the same functionality which demonstrates integration of Direct3D Viewer into .NET applications using WPF front end.
There is also another C# example with the same functionality, which demonstrates the integration of Direct3D Viewer into .NET applications using WPF front end.
See \subpage samples_csharp_direct3d "Readme" for details.
@subsubsection OCCT_OVW_SECTION_7_3_4 Android
There are two samples are representing usage OCCT framework on Android mobile platform. They represent an OCCT-based 3D-viewer with CAD import support in formats BREP, STEP and IGES: jniviewer (java) and AndroidQt (qt+qml)
jniviewer
@image html /overview/images/samples_java_android_occt.jpg
@image latex /overview/images/samples_java_android_occt.jpg
Java - See \subpage samples_java_android_occt "Readme" for details.
AndroidQt
@image html /overview/images/samples_qml_android_occt.jpg
@image latex /overview/images/samples_qml_android_occt.jpg
Qt - See \subpage samples_qml_android_occt "Readme" for details.

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -2713,7 +2713,7 @@ aPolyHLRToShape.OutLineHCompound();
@section occt_modalg_10_2 Meshing of Shapes
The algorithm of shape triangulation is provided by the functionality of *BRepMesh_IncrementalMesh* class, which adds a triangulation of the shape to its topological data structure.
The algorithm of shape triangulation is provided by the functionality of *BRepMesh_IncrementalMesh* class, which adds a triangulation of the shape to its topological data structure. This triangulation is used to visualize the shape in shaded mode.
~~~~~
const Standard_Real aRadius = 10.0;
@@ -2727,23 +2727,26 @@ const Standard_Real anAngularDeflection = 0.5;
BRepMesh_IncrementalMesh aMesh(aShape, aLinearDeflection, Standard_False, anAngularDeflection);
~~~~~
Default meshing algorithm *BRepMesh_IncrementalMesh* has two major options to define triangulation linear and angular deflections. At the first step all edges from face are discretized according to specified parameters. Linear deflection limits distance between curve and its tessellation and angular deflection limits the angle between subsequent segments in polyline.
The default meshing algorithm *BRepMesh_IncrementalMesh* has two major options to define triangulation linear and angular deflections.
@image html /user_guides/modeling_algos/images/modeling_algos_image056.png "Deflection parameters of BRepMesh_IncrementalMesh algorithm"
At the first step all edges from a face are discretized according to the specified parameters.
Linear deflection limits distance between triangles and face interior.
At the second step, the faces are tessellated. Linear deflection limits the distance between a curve and its tessellation, whereas angular deflection limits the angle between subsequent segments in a polyline.
@image html /user_guides/modeling_algos/images/modeling_algos_image057.png "Linear deflection"
@figure{/user_guides/modeling_algos/images/modeling_algos_image056.png, "Deflection parameters of BRepMesh_IncrementalMesh algorithm"}
Note that if given value of linear deflection is less than shape tolerance then the algorithm will skip this value and will take into account the shape tolerance.
Linear deflection limits the distance between triangles and the face interior.
Application should provide deflection parameters to compute satisfying mesh. Angular deflection is relatively simple and default value can be used (12-20 degrees). Linear deflection has absolute meaning and application should provide correct value for its models. Giving small values may result in too huge mesh (a lot of memory, long computation time and slow rendering) while big values results in ugly mesh.
@figure{/user_guides/modeling_algos/images/modeling_algos_image057.png, "Linear deflection"}
For application working in dimensions known in advance this is reasonable to fix absolute linear deflection for all models. This gives a meshes according to metrics and precision used in application (for example models known to be stored in meters and 0.004 m is enough for most tasks).
Note that if a given value of linear deflection is less than shape tolerance then the algorithm will skip this value and will take into account the shape tolerance.
However applications worked with alien models can not use the same deflection for all models (notice that this is abnormal situation in fact and this application is probably just a viewer for CAD models with dimensions vary by an order). To solve this problem conception of relative linear deflection was introduced that has some kind of LOD (level of detail) meaning. This value in fact is a scale factor to absolute deflection applied to model dimensions.
The application should provide deflection parameters to compute a satisfactory mesh. Angular deflection is relatively simple and allows using a default value (12-20 degrees). Linear deflection has an absolute meaning and the application should provide the correct value for its models. Giving small values may result in a too huge mesh (consuming a lot of memory, which results in a long computation time and slow rendering) while big values result in an ugly mesh.
For an application working in dimensions known in advance it can be reasonable to use the absolute linear deflection for all models. This provides meshes according to metrics and precision used in the application (for example, it it is known that the model will be stored in meters, 0.004 m is enough for most tasks).
Meshing covers a shape with a triangular mesh. Other than hidden line removal, you can use meshing to transfer the shape to another tool: a manufacturing tool, a shading algorithm, a finite element algorithm, or a collision algorithm, for example.
However, an application that imports models created in other applications may not use the same deflection for all models. Note that actually this is an abnormal situation and this application is probably just a viewer for CAD models with dimensions varying by an order of magnitude. This problem can be solved by introducing the concept of a relative linear deflection with some LOD (level of detail). The level of detail is a scale factor for absolute deflection, which is applied to model dimensions.
You can obtain information on the shape by first exploring it. To then access triangulation of a face in the shape, use *BRepTool::Triangulation*. To access a polygon which is the approximation of an edge of the face, use *BRepTool::PolygonOnTriangulation*.
Meshing covers a shape with a triangular mesh. Other than hidden line removal, you can use meshing to transfer the shape to another tool: a manufacturing tool, a shading algorithm, a finite element algorithm, or a collision algorithm.
You can obtain information on the shape by first exploring it. To access triangulation of a face in the shape later, use *BRepTool::Triangulation*. To access a polygon, which is the approximation of an edge of the face, use *BRepTool::PolygonOnTriangulation*.

View File

@@ -7,7 +7,7 @@
VIS component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library. This Users Guide describes how to apply VIS classes in application dealing with 3D visualization based on VTK library.
@figure{/user_guides/vis/images/vis_image001.png}
There are two ways to use VIS in the application:
* Use a **high-level API**. It is a simple scenario to use VTK viewer with displayed OCCT shapes. It considers usage of tools provided with VIS component such as a specific VTK data source, a picker class and specific VTK filters. Basically, in this scenario you enrich your custom VTK pipeline with extensions coming from VIS.
* Use a **low-level API**. It is an advanced scenario for the users with specific needs, which are not addressed by the higher-level utilities of VIS. It presumes implementation of custom VTK algorithms (such as filters) with help of low-level API of VIS component.
@@ -31,8 +31,8 @@ The idea behind the mentioned organization of packages is separation of interfac
@figure{/user_guides/vis/images/vis_image003.png "Dependencies of VIS packages"}
Basically, it is enough to use the first three packages in the end users application (*IVtk, IVtkOCC* and *IVtkVTK*) to be able to work with OCCT shapes in VTK viewer. However, *IVtkTools* package is also provided as a part of the component to make the work more comfortable.
@subsection occt_vis_2_2 IVtk package
**IVtk** package contains the following classes:
* *IVtk_Interface* - Base class for all interfaces of the component. Provides inheritance for *Handle* (OCCT “smart pointer”) functionality.
@@ -47,8 +47,8 @@ Basically, it is enough to use the first three packages in the end users appl
**IVtkOCC** package contains the implementation of classes depending on OCCT:
* *IVtkOCC_Shape* - Implementation of *IVtk_IShape* interface as a wrapper for *TopoDS_Shape*.
* *IVtkOCC_ShapeMesher* - Implementation of *IVtk_IShapeMesher* interface for construction of facets from *TopoDS* shapes.
* *IVtkOCC_ShapePickerAlgo* Implementation of interactive picking algorithm. It provides enabling/disabling of selection modes for shapes (*IVtk_IShape* instances) and picking facilities for a given position of cursor.
* *IVtkOCC_ViewerSelector* - Interactive selector, which implements *Pick()* methods for the picking algorithm *IVtkOCC_ShapePickerAlgo* and connects to the visualization layer with help of abstract *IView* interface.
* *IVtkOCC_ShapePickerAlgo* Implementation of interactive picking algorithm. It provides enabling/disabling of selection modes for shapes (*IVtk_IShape* instances) and picking facilities for a given position of cursor.
* *IVtkOCC_ViewerSelector* - Interactive selector, which implements *Pick()* methods for the picking algorithm *IVtkOCC_ShapePickerAlgo* and connects to the visualization layer with help of abstract *IView* interface.
*IVtkOCC_ViewerSelector* is a descendant of OCCT native *SelectMgr_ViewerSelector*, so it implements OCCT selection mechanism for *IVtkVTK_View* (similarly to *StdSelect_ViewerSelector3D* which implements *SelectMgr_ViewerSelector* for OCCT native *V3d_View*). *IVtkOCC_ViewerSelector* encapsulates all projection transformations for the picking mechanism. These transformations are extracted from *vtkCamera* instance available via VTK Renderer. *IVtkOCC_ViewerSelector* operates with native OCCT *SelectMgr_Selection* entities. Each entity represents one selection mode of an OCCT selectable object. *ViewerSelector* is an internal class, so it is not a part of the public API.
* *IVtkOCC_SelectableObject* - OCCT shape wrapper used in the picking algorithm for computation of selection primitives of a shape for a chosen selection mode.
@@ -68,7 +68,7 @@ Basically, it is enough to use the first three packages in the end users appl
Additionally, *IVtkTools* package contains auxiliary methods in *IVtkTools* namespace. E.g. there is a convenience function populating *vtkLookupTable* instances to set up a color scheme for better visualization of sub-shapes.
@section occt_vis_3 Using high-level API (simple scenario)
@section occt_vis_3 Using high-level API (simple scenario)
@subsection occt_vis_3_1 OCCT shape presentation in VTK viewer
To visualize an OCCT topological shape in VTK viewer, it is necessary to perform the following steps:
@@ -156,7 +156,7 @@ For example, the scalar-based coloring can be disabled to bind a single color to
The output of the shape data source can be presented in wireframe or shading display mode. A specific filter from class *IVtkTools_DisplayModeFilter* can be applied to select the display mode. The filter passes only the cells corresponding to the given mode. The set of available modes is defined by *IVtk_DisplayMode* enumeration.
@figure{/user_guides/vis/images/vis_image004.png}
For example, the shading representation can be obtained in the following way:
~~~~
@@ -176,7 +176,7 @@ By default, the display mode filter works in a wireframe mode.
TIP: to make the shading representation smooth, use additional *vtkPolyDataNormals* filter. This filter must be applied after the display mode filter.
@figure{/user_guides/vis/images/vis_image005.png}
@subsection occt_vis_3_4 Interactive selection
*IVtkTools* package provides *IVtkTools_ShapePicker* class to perform selection of OCCT shapes and sub-shapes in VTK viewer and access the picking results. The typical usage of *IVtkTools_ShapePicker* tool consists in the following sequence of actions:
1. Create a picker and set its renderer to your active VTK renderer:
@@ -241,7 +241,7 @@ OCCT picking algorithm *IVtkTools_ShapePicker* calculates a new transformation m
WARNING: VIS picker essentially works on the initial topological data structures rather than on the actually visualized actors. This peculiarity allows VIS to take advantage of standard OCCT selection mechanism, but puts strict limitations on the corresponding visualization pipelines. Once constructed, the faceted shape representation should not be morphed or translated anyhow. Otherwise, the picking results will lose their associativity with the source geometry. E.g. you should never use *vtkTransform* filter, but rather apply OCCT isometric transformation on the initial model in order to work on already relocated facet. These limitations are often acceptable for CAD visualization. If not, consider usage of a custom VTK-style picker working on the actually visualized actors.
@figure{/user_guides/vis/images/vis_image006.png}
@subsubsection occt_vis_3_5 Selection of sub-shapes
*IVtkTools_SubPolyDataFilter* is a handy VTK filter class which allows extraction of polygonal cells corresponding to the sub-shapes of the initial shape. It can be used to produce a *vtkPolyData* object from the input *vtkPolyData* object, using selection results from *IVTkTools_ShapePicker* tool.
@@ -282,7 +282,7 @@ The usage of low-level tools is justified in cases when the utilities from *IVtk
The low-level scenario of VIS usage in VTK pipeline is shown in the figure below. The Mesher component produces shape facet (VTK polygonal data) using implementation of *IShapeData* interface. Then result can be retrieved from this implementation as a *vtkPolyData* instance.
@figure{/user_guides/vis/images/vis_image007.png "Low-level VIS usage with VTK"}
The visualization pipeline for OCCT shape presentation can be initialized as follows:
1. Create an instance of *IShape* class initialized by OCCT topological shape:
~~~~
@@ -357,184 +357,10 @@ IVtk_ShapeIdList ids = myOccPickerAlgo->ShapesPicked();
~~~~
IVtk_ShapeIdList subShapeIds
= myOccPickerAlgo->SubShapesPicked(shapeId);
~~~~
~~~~
@section occt_vis_5 DRAW Test Harness
*TKIVtkDraw* toolkit contains classes for embedding VIS functionality into DRAW Test Harness with possibility of simple interactions, including detection and highlighting.
* *IVtkDraw_HighlightAndSelectionPipeline* - Creates VTK pipeline with OCCT shape data source and properly initialized VIS filters.
* *IVtkDraw_Interactor* - Controls simple interactive actions, such as detection and selection of the displayed shapes.
@section occt_vis_6 Test Harness Commands
A specific plugin with alias *VIS* should be loaded to have access to VIS functionality in DRAW Test Harness:
~~~~
\> pload VIS
~~~~
Typical use cases are available in non-regression tests scripts
@subsection occt_vis_6_1 ivtkinit
Purpose: Creates a window for VTK viewer.
Syntax: *ivtkinit*
@figure{/user_guides/vis/images/vis_image008.png}
@subsection occt_vis_6_2 ivtkdisplay
Purpose: Displays named objects.
Syntax: <i>ivtkdisplay name1 [name2] …[name n]</i>
Example
~~~~
ivtkinit
# create cone
pcone c 5 0 10
ivtkdisplay c
~~~~
@figure{/user_guides/vis/images/vis_image009.png}
@subsection occt_vis_6_3 ivtkerase
Purpose: Erases named objects. If no arguments are passed, erases all displayed objects.
Syntax: <i>ivtkerase [name1] [name2] … [name n] </i>
Example
~~~~
ivtkinit
# create a sphere
psphere s 10
# create a cone
pcone c 5 0 10
# create a cylinder
pcylinder cy 5 10
# display objects
ivtkdisplay s c cy
# erase only the cylinder
ivtkerase cy
# erase the sphere and the cone
ivtkerase s c
~~~~
@subsection occt_vis_6_4 ivtkfit
Purpose: Automatic zoom/panning.
Syntax: *ivtkfit*
@subsection occt_vis_6_5 ivtkdispmode
Purpose: Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects
The possible modes are: 0 (WireFrame) and 1 (Shading).
Syntax: <i>ivtksetdispmode [name] mode(0,1)</i>
Example
~~~~
ivtkinit
# create a cone
pcone c 5 0 10
# display the cone
ivtkdisplay c
# set shading mode for the cone
ivtksetdispmode c 1
~~~~
@figure{/user_guides/vis/images/vis_image010.png}
@subsection occt_vis_6_6 ivtksetselmode
Purpose: Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects
Syntax: <i>ivtksetselmode [name] mode on/off(0/1)</i>
Example
~~~~
ivtkinit
# load a shape from file
restore CrankArm.brep a
# display the loaded shape
ivtkdisplay a
# set the face selection mode
ivtksetselmode a 4 1
~~~~
@figure{/user_guides/vis/images/vis_image011.png}
@subsection occt_vis_6_7 ivtkmoveto
Purpose: Imitates mouse cursor moving to point with the given display coordinates.
Syntax: <i>ivtkmoveto x y</i>
Example
~~~~
ivtkinit
pcone c 5 0 10
ivtkdisplay c
ivtkmoveto 40 50
~~~~
@subsection occt_vis_6_8 ivtkselect
Purpose: Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point.
Syntax: <i>ivtkselect x y</i>
Example
~~~~
ivtkinit
pcone c 5 0 10
ivtkdisplay c
ivtkselect 40 50
~~~~
@subsection occt_vis_6_9 ivtkdump
Purpose: Dumps the contents of VTK viewer to image. It supports:
* dumping in different raster graphics formats: PNG, BMP, JPEG, TIFF or PNM.
* dumping of different buffers: RGB, RGBA or depth buffer.
* defining of image sizes (width and height in pixels).
* dumping of stereo projections (left or right).
Syntax: <i> ivtkdump *filename* [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}] </i>
Example
~~~~
ivtkinit
pcone c 5 0 10
ivtkdisplay c
ivtkdump D:/ConeSnapshot.png rgb 768 768
~~~~
@subsection occt_vis_6_10 ivtkbgcolor
Purpose: Sets uniform background color or gradient background if second triple of parameters is set. Color parameters r,g,b have to be chosen in the interval [0..255].
Syntax: <i> ivtkbgcolor r g b [r2 g2 b2] </i>
Example
~~~~
ivtkinit
ivtkbgcolor 200 220 250
~~~~
@figure{/user_guides/vis/images/vis_image012.png}
~~~~
ivtkbgcolor 10 30 80 255 255 255
~~~~
@figure{/user_guides/vis/images/vis_image013.png}
@section occt_vis_7 Non-regression tests
The test scenarios are available in <i> /test/v3d/ivtk </i> directory to test the functionality of VIS component. This directory contains test cases for all DRAW commands described above.

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -1,54 +1,51 @@
OCCT CSharp sample {#samples_csharp_occt}
==================
This sample demonstrates simple way of using OCCT libraries in .Net application
whitten using CSharp and Windows Forms or Windows Presentation Foundation (WPF).
This sample demonstrates how to use OCCT libraries in <b>.Net</b> application
written using **CSharp** and **Windows Forms** or **Windows Presentation Foundation** (WPF).
The connection between .Net and OCCT (C++) level is provided by proxy library,
OCCProxy, written in C++/CLI. The proxy library contains single ref class
encapsulating OCCT viewer and providing functionality to manipulate this viewer
and to import / export OCCT shapes from / to several supported formats of CAD
files (IGES, STEP, BREP).
The connection between .Net and OCCT (C++) level is provided by proxy library
**OCCProxy**, written in C++/CLI. The proxy library contains a single *ref* class
encapsulating OCCT viewer and providing the functionality to manipulate this viewer
and to import / export OCCT shapes from / to several supported CAD file formats (IGES, STEP, BREP).
The sample implements two approaches for organizing user interface with C#.
Both applications provide the same functionality as the standard OCCT
Import/Export sample.
First project is called "IE_WinForms" and uses Windows Forms for GUI.
Second application is called "IE_WPF_WinForms" and uses Windows Presentation Foundation.
The sample implements two approaches to the development of a user interface with C#.
Both applications provide the same functionality as the standard OCCT Import/Export sample.
The first project is called *IE_WinForms* and uses Windows Forms for GUI.
The second application is called *IE_WPF_WinForms* and uses Windows Presentation Foundation.
Note a few important details:
- to encapsulate C++ class into a field of ref class, template class
NCollection_Haft provided by OCCT is used
- OCCT template class *NCollection_Haft* is used to encapsulate C++ class into a field of *ref* class;
- in order to work consistently on 64-bit systems with OCCT libraries built in
32-bit mode, C# assemblies need to have platform target explicitly set to "x86"
(in project Properties / Build)
- It is necessary to explicitly set the target platform for C# assemblies to *x86*
in project **Properties - Build** to work consistently on 64-bit systems with OCCT libraries built in 32-bit mode;
- this sample demonstrates indirect method of wrapping C++ to C# using manually
created proxy library. Alternative method is available, wrapping individual
OCCT classes to C# equivalents so that their full API is available to C# user
and the code can be programmed on C# level similarly to C++ one. See desciption
of OCCT C# Wrapper in Advanced Samples and Tools on OCCT web site at
- this sample demonstrates indirect method of wrapping C++ to C# using a manually
created proxy library. There is an alternative method of wrapping individual
OCCT classes to C# equivalents to make their full API available to a C# user
and to let the code be programmed on C# level similarly to C++ one. See the description
of **OCCT C# Wrapper** in **Advanced Samples and Tools** at
http://www.opencascade.org/support/products/advsamples
- in WPF sample, WinForms control is used to encapsulate OCC viewer since WPF
does not provide necessary interface to embed OpenGl view. Other possible
solution could be to render OpenGl scene in off-screen buffer and map it
to WPF control as image. That approach would allow using all WPF features in
control embedding OCCT viewer.
- in WPF sample, **WinForms** control is used to encapsulate OCC viewer since WPF
does not provide the necessary interface to embed OpenGl view. Other possible
solution could be to render OpenGl scene in an off-screen buffer and to map it
to WPF control as an image. That approach would allow using all WPF features to
control the OCCT viewer.
Run msvc.bat to start MS Visual Studio for building the sample.
Run *msvc.bat* to start MS Visual Studio for building the sample.
Note that project files are provided only for VS 2010, you can open them in
newer versions of Visual Studio using automatic converter.
After conversion check option "Target framework" in properties of C# projects
(tab "Application") to ensure that it corresponds to the version set in
the properties of the C++ projects (e.g. ".Net Framework 4.0" for VS 2010).
newer versions of Visual Studio the using automatic converter.
Run run_winforms.bat or run_wpf.bat to launch the corresponding sample.
After conversion check option **Target framework** in the properties of C# projects
(tab **Application**) to make sure that it corresponds to the version set in
the properties of C++ projects (e.g. <b>.Net Framework 4.0</b> for VS 2010).
Note that all batch scripts use configuration defined in OCCT custom.bat file
Run *run_winforms.bat* or *run_wpf.bat* to launch the corresponding sample.
Note that all batch scripts use the configuration defined in OCCT *custom.bat* file
as default; you can provide arguments specifying VS version, bitness, and mode
to override these settings, e.g.:
> msvc.bat vc10 win64 Debug
> msvc.bat vc10 win64 Debug

View File

@@ -1,56 +1,54 @@
Direct3D CSharp sample {#samples_csharp_direct3d}
==================
This sample demonstrates simple way of using OCCT and DirectX libraries in .Net application
whitten using CSharp and Windows Presentation Foundation (WPF).
This sample demonstrates how to use OCCT and DirectX libraries in <b>.Net</b> application
written using **CSharp** and **Windows Presentation Foundation** (WPF).
The connection between .Net, OCCT (C++) and DirectX level is provided by proxy libraies,
OCCProxy and D3DProxy, written in C++/CLI. The proxy OCCProxy library contains single ref class
encapsulating OCCT viewer and providing functionality to manipulate this viewer
and to import / export OCCT shapes from / to several supported formats of CAD
files (IGES, STEP, BREP). And the proxy D3DProxy library contains helper methods for rendering
via DirectX.
The connection between .Net, OCCT (C++) and DirectX level is provided by proxy libraries,
**OCCProxy** and **D3DProxy**, written in C++/CLI. The proxy library **OCCProxy** contains a single
*ref* class encapsulating OCCT viewer and providing the functionality to manipulate this viewer
and to import / export OCCT shapes from / to several supported CAD file formats (IGES, STEP,
BREP). The proxy library **D3DProxy** contains helper methods for rendering via DirectX.
Organizing of user interface in this sample is provided by Windows Presentation Foundation (WPF).
And it has the same functionality as the standard OCCT Import/Export sample. The project is
called "IE_WPF_D3D".
The user interface in this sample is based on Windows Presentation Foundation (WPF).
It has the same functionality as the standard OCCT Import/Export sample. The project is
called *IE_WPF_D3D*.
Note a few important details:
- to build this sample you should to download and install DirectX SDK
http://www.microsoft.com/en-us/download/details.aspx?id=6812
- to encapsulate C++ class into a field of ref class, template class
NCollection_Haft provided by OCCT is used
- OCCT template class *NCollection_Haft* is used to encapsulate C++ class into a field of *ref* class;
- in order to work consistently on 64-bit systems with OCCT libraries built in
32-bit mode, C# assemblies need to have platform target explicitly set to "x86"
(in project Properties / Build)
- It is necessary to explicitly set the target platform for C# assemblies to *x86*
in project **Properties - Build** to work consistently on 64-bit systems with OCCT libraries built in 32-bit mode;
- this sample demonstrates indirect method of wrapping C++ to C# using manually
created proxy library. Alternative method is available, wrapping individual
OCCT classes to C# equivalents so that their full API is available to C# user
and the code can be programmed on C# level similarly to C++ one. See desciption
of OCCT C# Wrapper in Advanced Samples and Tools on OCCT web site at
- this sample demonstrates indirect method of wrapping C++ to C# using a manually
created proxy library. There is an alternative method of wrapping individual
OCCT classes to C# equivalents to make their full API available to a C# user
and to let the code be programmed on C# level similarly to C++ one. See the description
of **OCCT C# Wrapper** in **Advanced Samples and Tools** at
http://www.opencascade.org/support/products/advsamples
- in WPF sample, WinForms control is used to encapsulate OCC viewer since WPF
does not provide necessary interface to embed OpenGl view. Other possible
solution could be to render OpenGl scene in off-screen buffer and map it
to WPF control as image. That approach would allow using all WPF features in
control embedding OCCT viewer.
- in WPF sample, **WinForms** control is used to encapsulate OCC viewer since WPF
does not provide the necessary interface to embed OpenGl view. Other possible
solution could be to render OpenGl scene in an off-screen buffer and to map it
to WPF control as an image. That approach would allow using all WPF features to
control the OCCT viewer.
Run msvc.bat to start MS Visual Studio for building the sample.
Run *msvc.bat* to start MS Visual Studio for building the sample.
Note that project files are provided only for VS 2010, you can open them in
newer versions of Visual Studio using automatic converter.
After conversion check option "Target framework" in properties of C# projects
(tab "Application") to ensure that it corresponds to the version set in
the properties of the C++ projects (e.g. ".Net Framework 4.0" for VS 2010).
newer versions of Visual Studio using an automatic converter.
Run run_wpf-D3D.bat to launch the corresponding sample.
After conversion check option **Target framework** in the properties of C# projects
(tab **Application**) to make sure that it corresponds to the version set in
the properties of C++ projects (e.g. <b>.Net Framework 4.0</b> for VS 2010).
Note that all batch scripts use configuration defined in OCCT custom.bat file
Run *run_wpf-D3D.bat* to launch the corresponding sample.
Note that all batch scripts use the configuration defined in OCCT *custom.bat* file
as default; you can provide arguments specifying VS version, bitness, and mode
to override these settings, e.g.:
> msvc.bat vc10 win64 Debug
> msvc.bat vc10 win64 Debug

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/occtJniActivity/libs&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/occtJniActivity/jni&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="~/develop/android-ndk-r10/ndk-build"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="V=1 jniall"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/occtJniActivity/jni}"/>
</launchConfiguration>

4
samples/java/jniviewer/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
/assets
/bin
/gen
/libs

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>occtJniActivity</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/C++ Builder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.opencascade.jnisample">
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="OcctJniActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="" />
<data android:scheme="file" />
<data android:scheme="content" />
<data android:host="*" />
<data android:pathPattern=".*\\.brep" />
<data android:pathPattern=".*\\.rle" />
<data android:pathPattern=".*\\.step" />
<data android:pathPattern=".*\\.stp" />
<data android:pathPattern=".*\\.iges" />
<data android:pathPattern=".*\\.igs" />
</intent-filter>
</activity>
</application>
<uses-feature android:glEsVersion="0x00020000"/>
<uses-sdk android:minSdkVersion="15"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

View File

@@ -0,0 +1,58 @@
OCCT JniViewer sample for Android {#samples_java_android_occt}
==================
This sample demonstrates simple way of using OCCT libraries in Android application written using Java.
The connection between Java and OCCT (C++) level is provided by proxy library, libTKJniSample.so, written in C++ with exported JNI methods of Java class OcctJniRenderer.
The proxy library contains single C++ class OcctJni_Viewer encapsulating OCCT viewer and providing functionality to manipulate this viewer
and to import OCCT shapes from several supported formats of CAD files (IGES, STEP, BREP).
This sample demonstrates indirect method of wrapping C++ to Java using manually created proxy library.
Alternative method is available, wrapping individual OCCT classes to Java equivalents so that their full API is available to Java user
and the code can be programmed on Java level similarly to C++ one.
See description of OCCT Java Wrapper in Advanced Samples and Tools on OCCT web site at
http://www.opencascade.org/support/products/advsamples
Run Eclipse from ADT (Android Developer Tools) for building the sample. To import sample project perform
~~~~
File -> Import... -> Android -> Existing Android code into Workspace
~~~~
and specify this directory. The project re-build will be started immediately right after importation if "Build automatically" option is turned on (default in Eclipse).
Proxy library compilation and packaging is performed by NDK build script, called by "C++ Builder" configured within Eclipse project.
The path to "ndk-build" tool from Android NDK (Native Development Kit) should be specified in Eclipse project properties:
~~~~
Project -> Properties -> Builders -> C++ Builder -> Edit -> Location
~~~~
Now paths to OCCT C++ libraries and additional components should be specified in "jni/Android.mk" file:
~~~~
OCCT_ROOT := $(LOCAL_PATH)/../../../..
FREETYPE_INC := $(OCCT_ROOT)/../freetype/include/freetype2
FREETYPE_LIBS := $(OCCT_ROOT)/../freetype/libs
FREEIMAGE_INC := $(OCCT_ROOT)/../FreeImage/include
FREEIMAGE_LIBS := $(OCCT_ROOT)/../FreeImage/libs
OCCT_INC := $(OCCT_ROOT)/inc
OCCT_LIBS := $(OCCT_ROOT)/and/libs
~~~~
The list of extra components (Freetype, FreeImage) depends on OCCT configuration.
Variable $(TARGET_ARCH_ABI) is used within this script to refer to active architecture.
E.g. for 32-bit ARM build (see variable *APP_ABI* in "jni/Application.mk")
the folder *OCCT_LIBS* should contain sub-folder "armeabi-v7a" with OCCT libraries.
FreeImage is optional and does not required for this sample, however you should include all extra libraries used for OCCT building
and load the explicitly from Java code within OcctJniActivity::loadNatives() method, including toolkits from OCCT itself in proper order:
~~~~
if (!loadLibVerbose ("TKernel", aLoaded, aFailed)
|| !loadLibVerbose ("TKMath", aLoaded, aFailed)
|| !loadLibVerbose ("TKG2d", aLoaded, aFailed)
~~~~
Note that C++ STL library is not part of Android system.
Thus application must package this library as well as extra component.
"gnustl_shared" STL implementation is expected within this sample.
After successful build, the application can be packaged to Android:
- Deploy and run application on connected device or emulator directly from Eclipse using adb interface by menu items "Run" and "Debug". This would sign package with debug certificate.
- Prepare signed end-user package using wizard File -> Export -> Android -> Export Android Application.

View File

@@ -0,0 +1,215 @@
LOCAL_PATH:= $(call my-dir)
STL_INC := $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(NDK_TOOLCHAIN_VERSION)/include $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(NDK_TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/include
#STL_LIB := $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(NDK_TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/libgnustl_static.a
STL_LIB := $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(NDK_TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/libgnustl_shared.so
OCCT_ROOT := $(LOCAL_PATH)/../../../..
FREETYPE_INC := $(OCCT_ROOT)/../freetype/include/freetype2
FREETYPE_LIBS := $(OCCT_ROOT)/../freetype/libs
FREEIMAGE_INC := $(OCCT_ROOT)/../FreeImage/include
FREEIMAGE_LIBS := $(OCCT_ROOT)/../FreeImage/libs
OCCT_INC := $(OCCT_ROOT)/inc
OCCT_LIBS := $(OCCT_ROOT)/and/libs
ASSETDIR := $(LOCAL_PATH)/../assets
$(ASSETDIR)/Shaders: $(ASSETDIR)
-mkdir -p $(ASSETDIR)
-mkdir -p $(ASSETDIR)/Shaders
cp -f -r $(OCCT_ROOT)/src/Shaders/*.* $(ASSETDIR)/Shaders
$(ASSETDIR)/SHMessage: $(ASSETDIR)
-mkdir -p $(ASSETDIR)
-mkdir -p $(ASSETDIR)/SHMessage
cp -f -r $(OCCT_ROOT)/src/SHMessage/*.* $(ASSETDIR)/SHMessage
$(ASSETDIR)/XSMessage: $(ASSETDIR)
-mkdir -p $(ASSETDIR)
-mkdir -p $(ASSETDIR)/XSMessage
cp -f -r $(OCCT_ROOT)/src/XSMessage/*.* $(ASSETDIR)/XSMessage
$(ASSETDIR)/TObj: $(ASSETDIR)
-mkdir -p $(ASSETDIR)
-mkdir -p $(ASSETDIR)/TObj
cp -f -r $(OCCT_ROOT)/src/TObj/*.msg $(ASSETDIR)/TObj
$(ASSETDIR)/UnitsAPI: $(ASSETDIR)
-mkdir -p $(ASSETDIR)
-mkdir -p $(ASSETDIR)/UnitsAPI
cp -f -r $(OCCT_ROOT)/src/UnitsAPI/*.dat $(ASSETDIR)/UnitsAPI
pre_all: $(ASSETDIR)/Shaders $(ASSETDIR)/SHMessage $(ASSETDIR)/XSMessage $(ASSETDIR)/TObj $(ASSETDIR)/UnitsAPI
jniall: pre_all all
# STL libs
include $(CLEAR_VARS)
LOCAL_MODULE := SharedStl
LOCAL_EXPORT_C_INCLUDES := $(STL_INC)
LOCAL_SRC_FILES := $(STL_LIB)
include $(PREBUILT_SHARED_LIBRARY)
# 3rd-parties used in OCCT
include $(CLEAR_VARS)
LOCAL_MODULE := FreeType
LOCAL_EXPORT_C_INCLUDES := $(FREETYPE_INC)
LOCAL_SRC_FILES := $(FREETYPE_LIBS)/$(TARGET_ARCH_ABI)/libfreetype.so
include $(PREBUILT_SHARED_LIBRARY)
#include $(CLEAR_VARS)
#LOCAL_MODULE := FreeImage
#LOCAL_EXPORT_C_INCLUDES := $(FREEIMAGE_INC)
#LOCAL_SRC_FILES := $(FREEIMAGE_LIBS)/$(TARGET_ARCH_ABI)/libfreeimage.so
#include $(PREBUILT_SHARED_LIBRARY)
# OCCT core
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKernel
LOCAL_EXPORT_C_INCLUDES := $(OCCT_INC)
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKernel.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKMath
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKMath.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKG2d
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKG2d.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKG3d
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKG3d.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKGeomBase
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKGeomBase.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKBRep
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKBRep.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKGeomAlgo
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKGeomAlgo.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKTopAlgo
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKTopAlgo.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKShHealing
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKShHealing.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKMesh
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKMesh.so
include $(PREBUILT_SHARED_LIBRARY)
# OCCT Exchange
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKPrim
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKPrim.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKBO
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKBO.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKBool
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKBool.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKFillet
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKFillet.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKOffset
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKOffset.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKXSBase
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKXSBase.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKIGES
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKIGES.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKSTEPBase
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKSTEPBase.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKSTEPAttr
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKSTEPAttr.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKSTEP209
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKSTEP209.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKSTEP
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKSTEP.so
include $(PREBUILT_SHARED_LIBRARY)
# OCCT visualization
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKService
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKService.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKHLR
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKHLR.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKV3d
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKV3d.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OcctTKOpenGl
LOCAL_SRC_FILES := $(OCCT_LIBS)/$(TARGET_ARCH_ABI)/libTKOpenGl.so
include $(PREBUILT_SHARED_LIBRARY)
# our sample
include $(CLEAR_VARS)
LOCAL_MODULE := libTKJniSample
LOCAL_C_INCLUDES := $(STL_INC)
#LOCAL_STATIC_LIBRARIES := $(STL_LIB) does not work
LOCAL_CFLAGS := -Wall
LOCAL_CPP_EXTENSION := .cxx .cpp
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_SRC_FILES := OcctJni_Viewer.cxx OcctJni_Window.cxx OcctJni_MsgPrinter.cxx
LOCAL_SHARED_LIBRARIES := OcctTKernel OcctTKMath OcctTKG2d OcctTKG3d OcctTKGeomBase OcctTKBRep OcctTKGeomAlgo OcctTKTopAlgo OcctTKShHealing OcctTKMesh OcctTKPrim
LOCAL_SHARED_LIBRARIES += OcctTKIGES OcctTKSTEP OcctTKXSBase
LOCAL_SHARED_LIBRARIES += OcctTKService OcctTKHLR OcctTKV3d OcctTKOpenGl
LOCAL_SHARED_LIBRARIES += SharedStl
LOCAL_LDLIBS := -llog -lGLESv2 -lEGL
#LOCAL_LDLIBS += $(STL_LIB)
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,8 @@
NDK_TOOLCHAIN_VERSION := 4.8
APP_PLATFORM := android-15
APP_ABI := armeabi-v7a
#APP_ABI := all
#APP_STL := gnustl_static
#APP_STL := stlport_static

View File

@@ -0,0 +1,102 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <OcctJni_MsgPrinter.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <android/log.h>
IMPLEMENT_STANDARD_HANDLE (OcctJni_MsgPrinter, Message_Printer)
IMPLEMENT_STANDARD_RTTIEXT(OcctJni_MsgPrinter, Message_Printer)
// =======================================================================
// function : OcctJni_MsgPrinter
// purpose :
// =======================================================================
OcctJni_MsgPrinter::OcctJni_MsgPrinter (JNIEnv* theJEnv,
jobject theJObj)
: myJEnv (theJEnv),
myJObj (theJEnv->NewGlobalRef (theJObj)),
myJMet (NULL)
{
jclass aJClass = theJEnv->GetObjectClass (theJObj);
myJMet = theJEnv->GetMethodID (aJClass, "postMessage", "(Ljava/lang/String;)V");
if (myJMet == NULL)
{
__android_log_write (ANDROID_LOG_FATAL, "jniSample", "Broken initialization of OcctJni_MsgPrinter!");
}
}
// =======================================================================
// function : ~OcctJni_MsgPrinter
// purpose :
// =======================================================================
OcctJni_MsgPrinter::~OcctJni_MsgPrinter()
{
//myJEnv->DeleteGlobalRef (myJObj);
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const TCollection_ExtendedString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity >= myTraceLevel)
{
const TCollection_AsciiString aStr (theString);
OcctJni_MsgPrinter::Send (aStr, theGravity, theToPutEndl);
}
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity < myTraceLevel)
{
return;
}
///__android_log_write (ANDROID_LOG_DEBUG, "OcctJni_MsgPrinter", (TCollection_AsciiString(" @@ ") + theString).ToCString());
if (myJMet == NULL)
{
return;
}
jstring aJStr = myJEnv->NewStringUTF ((theString + "\n").ToCString());
myJEnv->CallObjectMethod (myJObj, myJMet, aJStr);
myJEnv->DeleteLocalRef (aJStr);
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const Standard_CString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity >= myTraceLevel)
{
OcctJni_MsgPrinter::Send (TCollection_AsciiString (theString), theGravity, theToPutEndl);
}
}

View File

@@ -0,0 +1,62 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef OcctJni_MsgPrinter_H
#define OcctJni_MsgPrinter_H
#include <Message_Printer.hxx>
#include <jni.h>
// Class providing connection between messenger interfaces in C++ and Java layers.
class OcctJni_MsgPrinter : public Message_Printer
{
public:
//! Default constructor
OcctJni_MsgPrinter (JNIEnv* theJEnv,
jobject theJObj);
//! Destructor.
~OcctJni_MsgPrinter();
//! Redirection to TCollection_AsciiString method
virtual void Send (const TCollection_ExtendedString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
//! Redirection to TCollection_AsciiString method
virtual void Send (const Standard_CString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
//! Main printing method
virtual void Send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
private:
JNIEnv* myJEnv;
jobject myJObj;
jmethodID myJMet;
public:
DEFINE_STANDARD_RTTI(OcctJni_MsgPrinter)
};
DEFINE_STANDARD_HANDLE(OcctJni_MsgPrinter, Message_Printer)
#endif // OcctJni_MsgPrinter_H

View File

@@ -0,0 +1,810 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <OcctJni_Viewer.hxx>
#include <OcctJni_MsgPrinter.hxx>
#include <AIS_Shape.hxx>
#include <Image_AlienPixMap.hxx>
#include <BRepTools.hxx>
#include <Message_Messenger.hxx>
#include <Message_MsgFile.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <OSD_Environment.hxx>
#include <OSD_Timer.hxx>
#include <Standard_Version.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <STEPControl_Reader.hxx>
#include <IGESControl_Reader.hxx>
#include <XSControl_WorkSession.hxx>
#include <EGL/egl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <jni.h>
//! @return true if file exists
static bool isFileExist (const TCollection_AsciiString& thePath)
{
struct stat64 aStatBuffer;
return stat64 (thePath.ToCString(), &aStatBuffer) == 0;
}
//! Cut-off the last split character from the path and everything after it.
static TCollection_AsciiString getParentDir (const TCollection_AsciiString& thePath)
{
TCollection_AsciiString aPath = thePath;
char* aSplitter = (char* )aPath.ToCString();
for (char* anIter = aSplitter; *anIter != '\0'; ++anIter)
{
if (*anIter == '\\'
|| *anIter == '/')
{
aSplitter = anIter;
}
}
*aSplitter = '\0'; // cut off file name or trailing folder
return TCollection_AsciiString (aPath.ToCString());
}
//! Set environment variable theVarName indicating location of resource
//! file theFile so as to correspond to actual location of this file.
//!
//! The resource file is searched in directory where Test.Draw.dll is located,
//! and if not found - also in subdirectory ../res from there.
//! If file is found, environment variable is set for C subsystem.
//! Otherwise, environment is not changed.
//!
//! If theToAddFileName is true, complete file name is set as value of the variable,
//! if theToAddFileName is false, only path is set.
Standard_Boolean setResourceEnv (const TCollection_AsciiString& theVarName,
const TCollection_AsciiString& theRoot,
const TCollection_AsciiString& theFile,
const Standard_Boolean theToAddFileName)
{
// use location of current assembly to figure out possible location of resource
TCollection_AsciiString aBaseDir = theRoot;
// check the same directory where binary is located
if (!isFileExist (aBaseDir + "/" + theFile))
{
// check subdirectory ../res
aBaseDir = getParentDir (aBaseDir) + "/res";
if (!isFileExist (aBaseDir + "/" + theFile))
{
return Standard_False;
}
}
// set C library environment
if (theToAddFileName)
{
aBaseDir = aBaseDir + "/" + theFile;
}
OSD_Environment anEnv (theVarName, aBaseDir);
anEnv.Build();
return Standard_True;
}
// =======================================================================
// function : OcctJni_Viewer
// purpose :
// =======================================================================
OcctJni_Viewer::OcctJni_Viewer()
{
// prepare necessary environment
TCollection_AsciiString aResRoot = "/data/data/com.opencascade.jnisample/files";
setResourceEnv ("CSF_TObjMessage", aResRoot + "/TObj", "TObj.msg", Standard_False);
setResourceEnv ("CSF_UnitsLexicon", aResRoot + "/UnitsAPI", "Lexi_Expr.dat", Standard_True);
setResourceEnv ("CSF_UnitsDefinition", aResRoot + "/UnitsAPI", "Units.dat", Standard_True);
setResourceEnv ("CSF_ShadersDirectory", aResRoot + "/Shaders", "Declarations.glsl", Standard_False);
setResourceEnv ("CSF_XSMessage", aResRoot + "/XSMessage", "XSTEP.us", Standard_False);
setResourceEnv ("CSF_SHMessage", aResRoot + "/XSMessage", "SHAPE.us", Standard_False);
//setResourceEnv ("CSF_PluginDefaults", "Plugin", Standard_False);
// make sure OCCT loads the dictionary
//UnitsAPI::SetLocalSystem (UnitsAPI_SI);
// load messages for TObj
Message_MsgFile::LoadFromEnv ("CSF_TObjMessage", "TObj", "msg");
}
// =======================================================================
// function : init
// purpose :
// =======================================================================
bool OcctJni_Viewer::init()
{
EGLint aCfgId = 0;
int aWidth = 0, aHeight = 0;
EGLDisplay anEglDisplay = eglGetCurrentDisplay();
EGLContext anEglContext = eglGetCurrentContext();
EGLSurface anEglSurf = eglGetCurrentSurface (EGL_DRAW);
if (anEglDisplay == EGL_NO_DISPLAY
|| anEglContext == EGL_NO_CONTEXT
|| anEglSurf == EGL_NO_SURFACE)
{
Message::DefaultMessenger()->Send ("Error: No active EGL context!", Message_Fail);
release();
return false;
}
eglQuerySurface (anEglDisplay, anEglSurf, EGL_WIDTH, &aWidth);
eglQuerySurface (anEglDisplay, anEglSurf, EGL_HEIGHT, &aHeight);
eglQuerySurface (anEglDisplay, anEglSurf, EGL_CONFIG_ID, &aCfgId);
const EGLint aConfigAttribs[] = { EGL_CONFIG_ID, aCfgId, EGL_NONE };
EGLint aNbConfigs = 0;
void* anEglConfig = NULL;
if (eglChooseConfig (anEglDisplay, aConfigAttribs, &anEglConfig, 1, &aNbConfigs) != EGL_TRUE)
{
Message::DefaultMessenger()->Send ("Error: EGL does not provide compatible configurations!", Message_Fail);
release();
return false;
}
TCollection_AsciiString anEglInfo = TCollection_AsciiString()
+ "\n EGLVersion: " + eglQueryString (anEglDisplay, EGL_VERSION)
+ "\n EGLVendor: " + eglQueryString (anEglDisplay, EGL_VENDOR)
+ "\n EGLClient APIs: " + eglQueryString (anEglDisplay, EGL_CLIENT_APIS)
+ "\n GLvendor: " + (const char* )glGetString (GL_VENDOR)
+ "\n GLdevice: " + (const char* )glGetString (GL_RENDERER)
+ "\n GLversion: " + (const char* )glGetString (GL_VERSION) + " [GLSL: " + (const char* )glGetString (GL_SHADING_LANGUAGE_VERSION) + "]";
::Message::DefaultMessenger()->Send (anEglInfo, Message_Info);
if (!myViewer.IsNull())
{
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (myViewer->Driver());
Handle(OcctJni_Window) aWindow = Handle(OcctJni_Window)::DownCast (myView->Window());
if (!aDriver->InitEglContext (anEglDisplay, anEglContext, anEglConfig))
{
Message::DefaultMessenger()->Send ("Error: OpenGl_GraphicDriver can not be initialized!", Message_Fail);
release();
return false;
}
aWindow->SetSize (aWidth, aHeight);
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL);
return true;
}
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver (NULL, Standard_False);
aDriver->ChangeOptions().buffersNoSwap = Standard_True;
//aDriver->ChangeOptions().glslWarnings = Standard_True; /// for debug only!
if (!aDriver->InitEglContext (anEglDisplay, anEglContext, anEglConfig))
{
Message::DefaultMessenger()->Send ("Error: OpenGl_GraphicDriver can not be initialized!", Message_Fail);
release();
return false;
}
// create viewer
myViewer = new V3d_Viewer (aDriver, TCollection_ExtendedString("Viewer").ToExtString(), "", 1000.0,
V3d_XposYnegZpos, Quantity_NOC_BLACK, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
Standard_True, Standard_False);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
// create AIS context
myContext = new AIS_InteractiveContext (myViewer);
//myContext->SetDisplayMode (AIS_WireFrame);
myContext->SetDisplayMode (AIS_Shaded);
Handle(OcctJni_Window) aWindow = new OcctJni_Window (aWidth, aHeight);
myView = myViewer->CreateView();
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL);
myView->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_WHITE, 0.08, V3d_ZBUFFER);
initContent();
return true;
}
// =======================================================================
// function : release
// purpose :
// =======================================================================
void OcctJni_Viewer::release()
{
myContext.Nullify();
myView.Nullify();
myViewer.Nullify();
}
// =======================================================================
// function : resize
// purpose :
// =======================================================================
void OcctJni_Viewer::resize (int theWidth,
int theHeight)
{
if (myContext.IsNull())
{
Message::DefaultMessenger()->Send ("Resize failed - view is unavailable", Message_Fail);
return;
}
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (myViewer->Driver());
Handle(OcctJni_Window) aWindow = Handle(OcctJni_Window)::DownCast (myView->Window());
aWindow->SetSize (theWidth, theHeight);
//myView->MustBeResized(); // can be used instead of SetWindow() when EGLsurface has not been changed
EGLContext anEglContext = eglGetCurrentContext();
myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL);
//saveSnapshot ("/sdcard/Download/tt.png", theWidth, theHeight);
}
// =======================================================================
// function : initContent
// purpose :
// =======================================================================
void OcctJni_Viewer::initContent()
{
myContext->RemoveAll (Standard_False);
OSD_Timer aTimer;
aTimer.Start();
if (!myShape.IsNull())
{
Handle(AIS_Shape) aShapePrs = new AIS_Shape (myShape);
myContext->Display (aShapePrs, Standard_False);
}
else
{
BRepPrimAPI_MakeBox aBuilder (1.0, 2.0, 3.0);
Handle(AIS_Shape) aShapePrs = new AIS_Shape (aBuilder.Shape());
myContext->Display (aShapePrs, Standard_False);
}
myView->FitAll();
aTimer.Stop();
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "Presentation computed in " + aTimer.ElapsedTime() + " seconds", Message_Info);
}
//! Load shape from IGES file
static TopoDS_Shape loadIGES (const TCollection_AsciiString& thePath)
{
TopoDS_Shape aShape;
IGESControl_Reader aReader;
IFSelect_ReturnStatus aReadStatus = IFSelect_RetFail;
try
{
aReadStatus = aReader.ReadFile (thePath.ToCString());
}
catch (Standard_Failure)
{
Message::DefaultMessenger()->Send ("Error: IGES reader, computation error", Message_Fail);
return aShape;
}
if (aReadStatus != IFSelect_RetDone)
{
Message::DefaultMessenger()->Send ("Error: IGES reader, bad file format", Message_Fail);
return aShape;
}
// now perform the translation
aReader.TransferRoots();
if (aReader.NbShapes() <= 0)
{
Handle(XSControl_WorkSession) aWorkSession = new XSControl_WorkSession();
aWorkSession->SelectNorm ("IGES");
aReader.SetWS (aWorkSession, Standard_True);
aReader.SetReadVisible (Standard_False);
aReader.TransferRoots();
}
if (aReader.NbShapes() <= 0)
{
Message::DefaultMessenger()->Send ("Error: IGES reader, no shapes has been found", Message_Fail);
return aShape;
}
return aReader.OneShape();
/*TopoDS_Shape anImportedShape = aReader.OneShape();
// apply sewing on the imported shape
BRepBuilderAPI_Sewing aTool (0.0);
aTool.SetNonManifoldMode (Standard_False);
aTool.SetFloatingEdgesMode(Standard_True);
aTool.Load (anImportedShape);
aTool.Perform();
TopoDS_Shape aSewedShape = aTool.SewedShape();
if (aSewedShape.IsNull())
{
Message::DefaultMessenger()->Send ("Error: Sewing result is empty", Message_Fail);
return aShape;
}
if (aSewedShape.IsSame(anImportedShape))
{
aShape = anImportedShape;
}
else
{
// apply shape healing
ShapeFix_Shape aShapeFixer(aSewedShape);
aShapeFixer.FixSolidMode() = 1;
aShapeFixer.FixFreeShellMode() = 1;
aShapeFixer.FixFreeFaceMode() = 1;
aShapeFixer.FixFreeWireMode() = 0;
aShapeFixer.FixSameParameterMode() = 0;
aShapeFixer.FixVertexPositionMode() = 0;
aShape = aShapeFixer.Perform() ? aShapeFixer.Shape() : aSewedShape;
}
return aShape;*/
}
//! Load shape from STEP file
static TopoDS_Shape loadSTEP (const TCollection_AsciiString& thePath)
{
STEPControl_Reader aReader;
IFSelect_ReturnStatus aReadStatus = IFSelect_RetFail;
try
{
aReadStatus = aReader.ReadFile (thePath.ToCString());
}
catch (Standard_Failure)
{
Message::DefaultMessenger()->Send ("Error: STEP reader, computation error", Message_Fail);
return TopoDS_Shape();
}
if (aReadStatus != IFSelect_RetDone)
{
Message::DefaultMessenger()->Send ("Error: STEP reader, bad file format", Message_Fail);
return TopoDS_Shape();
}
else if (aReader.NbRootsForTransfer() <= 0)
{
Message::DefaultMessenger()->Send ("Error: STEP reader, shape is empty", Message_Fail);
return TopoDS_Shape();
}
// now perform the translation
aReader.TransferRoots();
return aReader.OneShape();
}
// =======================================================================
// function : open
// purpose :
// =======================================================================
bool OcctJni_Viewer::open (const TCollection_AsciiString& thePath)
{
myShape.Nullify();
if (!myContext.IsNull())
{
myContext->RemoveAll (Standard_False);
}
if (thePath.IsEmpty())
{
return false;
}
OSD_Timer aTimer;
aTimer.Start();
TCollection_AsciiString aFormatStr;
const Standard_Integer aLen = thePath.Length();
if (aLen >= 5
&& thePath.Value (aLen - 4) == '.')
{
aFormatStr = thePath.SubString (aLen - 3, aLen);
}
else if (aLen >= 4
&& thePath.Value (aLen - 3) == '.')
{
aFormatStr = thePath.SubString (aLen - 2, aLen);
}
else if (aLen >= 3
&& thePath.Value (aLen - 2) == '.')
{
aFormatStr = thePath.SubString (aLen - 1, aLen);
}
aFormatStr.LowerCase();
TopoDS_Shape aShape;
if (aFormatStr == "stp"
|| aFormatStr == "step")
{
aShape = loadSTEP (thePath);
}
else if (aFormatStr == "igs"
|| aFormatStr == "iges")
{
aShape = loadIGES (thePath);
}
else
// if (aFormatStr == "brep"
// || aFormatStr == "rle")
{
BRep_Builder aBuilder;
if (!BRepTools::Read (aShape, thePath.ToCString(), aBuilder))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "Error: file '" + thePath + "' can not be opened!", Message_Info);
return false;
}
}
if (aShape.IsNull())
{
return false;
}
aTimer.Stop();
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "File '" + thePath + "' loaded in " + aTimer.ElapsedTime() + " seconds", Message_Info);
myShape = aShape;
if (myContext.IsNull())
{
return true;
}
aTimer.Reset();
aTimer.Start();
Handle(AIS_Shape) aShapePrs = new AIS_Shape (aShape);
myContext->Display (aShapePrs, Standard_False);
myView->FitAll();
aTimer.Stop();
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "Presentation computed in " + aTimer.ElapsedTime() + " seconds", Message_Info);
return true;
}
// =======================================================================
// function : saveSnapshot
// purpose :
// =======================================================================
bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
int theWidth,
int theHeight)
{
if (myContext.IsNull()
|| thePath.IsEmpty())
{
Message::DefaultMessenger()->Send ("Image dump failed - view is unavailable", Message_Fail);
return false;
}
if (theWidth < 1
|| theHeight < 1)
{
myView->Window()->Size (theWidth, theHeight);
}
if (theWidth < 1
|| theHeight < 1)
{
Message::DefaultMessenger()->Send ("Image dump failed - view is unavailable", Message_Fail);
return false;
}
Image_AlienPixMap anAlienImage;
if (!anAlienImage.InitTrash (Image_PixMap::ImgBGRA, theWidth, theHeight))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "RGBA image " + theWidth + "x" + theHeight + " allocation failed", Message_Fail);
return false;
}
// OpenGL ES does not support fetching data in BGRA format
// while FreeImage does not support RGBA format.
Image_PixMap anImage;
anImage.InitWrapper (Image_PixMap::ImgRGBA,
anAlienImage.ChangeData(),
anAlienImage.SizeX(),
anAlienImage.SizeY(),
anAlienImage.SizeRowBytes());
if (!myView->ToPixMap (anImage, theWidth, theHeight, Graphic3d_BT_RGBA))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "View dump to the image " + theWidth + "x" + theHeight + " failed", Message_Fail);
}
for (Standard_Size aRow = 0; aRow < anAlienImage.SizeY(); ++aRow)
{
for (Standard_Size aCol = 0; aCol < anAlienImage.SizeX(); ++aCol)
{
Image_ColorRGBA& aPixel = anAlienImage.ChangeValue<Image_ColorRGBA> (aRow, aCol);
std::swap (aPixel.r(), aPixel.b());
//aPixel.a() = 1.0;
}
}
if (!anAlienImage.Save (thePath))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "Image saving to path '" + thePath + "' failed", Message_Fail);
return false;
}
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "View " + theWidth + "x" + theHeight + " dumped to image '" + thePath + "'", Message_Info);
return true;
}
// =======================================================================
// function : redraw
// purpose :
// =======================================================================
void OcctJni_Viewer::redraw()
{
if (myView.IsNull())
{
return;
}
myView->Redraw();
}
// =======================================================================
// function : fitAll
// purpose :
// =======================================================================
void OcctJni_Viewer::fitAll()
{
if (myView.IsNull())
{
return;
}
myView->FitAll();
}
// =======================================================================
// function : startRotation
// purpose :
// =======================================================================
void OcctJni_Viewer::startRotation (int theStartX,
int theStartY)
{
if (myView.IsNull())
{
return;
}
myView->StartRotation (theStartX, theStartY, 0.45);
}
// =======================================================================
// function : onRotation
// purpose :
// =======================================================================
void OcctJni_Viewer::onRotation (int theX,
int theY)
{
if (myView.IsNull())
{
return;
}
myView->Rotation (theX, theY);
}
// =======================================================================
// function : onPanning
// purpose :
// =======================================================================
void OcctJni_Viewer::onPanning (int theDX,
int theDY)
{
if (myView.IsNull())
{
return;
}
myView->Pan (theDX, theDY);
}
// =======================================================================
// function : onClick
// purpose :
// =======================================================================
void OcctJni_Viewer::onClick (int theX,
int theY)
{
if (myView.IsNull())
{
return;
}
myContext->MoveTo (theX, theY, myView, Standard_False);
myContext->Select (Standard_True);
}
// =======================================================================
// function : stopAction
// purpose :
// =======================================================================
void OcctJni_Viewer::stopAction()
{
if (myView.IsNull())
{
return;
}
}
#define jexp extern "C" JNIEXPORT
jexp jlong JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppCreate (JNIEnv* theEnv,
jobject theObj)
{
return jlong(new OcctJni_Viewer());
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppDestroy (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
delete (OcctJni_Viewer* )theCppPtr;
Handle(Message_Messenger) aMsgMgr = Message::DefaultMessenger();
aMsgMgr->RemovePrinters (STANDARD_TYPE (OcctJni_MsgPrinter));
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppRelease (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->release();
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppInit (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
Handle(Message_Messenger) aMsgMgr = Message::DefaultMessenger();
aMsgMgr->RemovePrinters (STANDARD_TYPE (OcctJni_MsgPrinter));
aMsgMgr->AddPrinter (new OcctJni_MsgPrinter (theEnv, theObj));
((OcctJni_Viewer* )theCppPtr)->init();
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppResize (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr,
jint theWidth,
jint theHeight)
{
((OcctJni_Viewer* )theCppPtr)->resize (theWidth, theHeight);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppOpen (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr,
jstring thePath)
{
const char* aPathPtr = theEnv->GetStringUTFChars (thePath, 0);
const TCollection_AsciiString aPath (aPathPtr);
theEnv->ReleaseStringUTFChars (thePath, aPathPtr);
((OcctJni_Viewer* )theCppPtr)->open (aPath);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppRedraw (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->redraw();
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetAxoProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_XposYnegZpos);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetXposProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_Xpos);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetYposProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_Ypos);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetZposProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_Zpos);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetXnegProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_Xneg);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetYnegProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_Yneg);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppSetZnegProj (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->setProj (V3d_Zneg);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppFitAll (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->fitAll();
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppStartRotation (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr,
jint theStartX,
jint theStartY)
{
((OcctJni_Viewer* )theCppPtr)->startRotation (theStartX, theStartY);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppOnRotation (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr,
jint theX,
jint theY)
{
((OcctJni_Viewer* )theCppPtr)->onRotation (theX, theY);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppOnPanning (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr,
jint theDX,
jint theDY)
{
((OcctJni_Viewer* )theCppPtr)->onPanning (theDX, theDY);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppOnClick (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr,
jint theX,
jint theY)
{
((OcctJni_Viewer* )theCppPtr)->onClick (theX, theY);
}
jexp void JNICALL Java_com_opencascade_jnisample_OcctJniRenderer_cppStopAction (JNIEnv* theEnv,
jobject theObj,
jlong theCppPtr)
{
((OcctJni_Viewer* )theCppPtr)->stopAction();
}
jexp jlong JNICALL Java_com_opencascade_jnisample_OcctJniActivity_cppOcctMajorVersion (JNIEnv* theEnv,
jobject theObj)
{
return OCC_VERSION_MAJOR;
}
jexp jlong JNICALL Java_com_opencascade_jnisample_OcctJniActivity_cppOcctMinorVersion (JNIEnv* theEnv,
jobject theObj)
{
return OCC_VERSION_MINOR;
}
jexp jlong JNICALL Java_com_opencascade_jnisample_OcctJniActivity_cppOcctMicroVersion (JNIEnv* theEnv,
jobject theObj)
{
return OCC_VERSION_MAINTENANCE;
}

View File

@@ -0,0 +1,88 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <OcctJni_Window.hxx>
#include <AIS_InteractiveContext.hxx>
#include <TopoDS_Shape.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
//! Main C++ back-end for activity.
class OcctJni_Viewer
{
public:
//! Empty constructor
OcctJni_Viewer();
//! Initialize the viewer
bool init();
//! Release the viewer
void release();
//! Resize the viewer
void resize (int theWidth,
int theHeight);
//! Open CAD file
bool open (const TCollection_AsciiString& thePath);
//! Take snapshot
bool saveSnapshot (const TCollection_AsciiString& thePath,
int theWidth = 0,
int theHeight = 0);
//! Viewer update.
void redraw();
//! Move camera
void setProj (V3d_TypeOfOrientation theProj) { if (!myView.IsNull()) myView->SetProj (theProj); }
//! Fit All.
void fitAll();
//! Start rotation (remember first point position)
void startRotation (int theStartX,
int theStartY);
//! Perform rotation (relative to first point)
void onRotation (int theX,
int theY);
//! Perform panning
void onPanning (int theDX,
int theDY);
//! Perform selection
void onClick (int theX,
int theY);
//! Stop previously started action
void stopAction();
protected:
//! Reset viewer content.
void initContent();
protected:
Handle(V3d_Viewer) myViewer;
Handle(V3d_View) myView;
Handle(AIS_InteractiveContext) myContext;
TopoDS_Shape myShape;
};

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <OcctJni_Window.hxx>
IMPLEMENT_STANDARD_HANDLE (OcctJni_Window, Aspect_Window)
IMPLEMENT_STANDARD_RTTIEXT(OcctJni_Window, Aspect_Window)

View File

@@ -0,0 +1,106 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef OcctJni_Window_H
#define OcctJni_Window_H
#include <Aspect_Window.hxx>
//! This class defines dummy window
class OcctJni_Window : public Aspect_Window
{
public:
//! Creates a wrapper over existing Window handle
OcctJni_Window (const int theWidth, const int theHeight)
: myWidth (theWidth), myHeight(theHeight) {}
//! Returns native Window handle
virtual Aspect_Drawable NativeHandle() const { return 0; }
//! Returns parent of native Window handle
virtual Aspect_Drawable NativeParentHandle() const { return 0; }
virtual void Destroy() {}
//! Opens the window <me>
virtual void Map() const {}
//! Closes the window <me>
virtual void Unmap() const {}
//! Applies the resizing to the window <me>
virtual Aspect_TypeOfResize DoResize() const { return Aspect_TOR_UNKNOWN; }
//! Apply the mapping change to the window <me>
virtual Standard_Boolean DoMapping() const { return Standard_True; }
//! Returns True if the window <me> is opened
virtual Standard_Boolean IsMapped() const { return Standard_True; }
//! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions
virtual Quantity_Ratio Ratio() const { return 1.0; }
//! Returns The Window POSITION in PIXEL
virtual void Position (Standard_Integer& theX1,
Standard_Integer& theY1,
Standard_Integer& theX2,
Standard_Integer& theY2) const
{
theX1 = 0;
theX2 = myWidth;
theY1 = 0;
theY2 = myHeight;
}
//! Set The Window POSITION in PIXEL
virtual void SetPosition (const Standard_Integer theX1,
const Standard_Integer theY1,
const Standard_Integer theX2,
const Standard_Integer theY2)
{
myWidth = theX2 - theX1;
myHeight = theY2 - theY1;
}
//! Returns The Window SIZE in PIXEL
virtual void Size (Standard_Integer& theWidth,
Standard_Integer& theHeight) const
{
theWidth = myWidth;
theHeight = myHeight;
}
//! Set The Window SIZE in PIXEL
virtual void SetSize (const Standard_Integer theWidth,
const Standard_Integer theHeight)
{
myWidth = theWidth;
myHeight = theHeight;
}
private:
int myWidth;
int myHeight;
public:
DEFINE_STANDARD_RTTI(OcctJni_Window)
};
DEFINE_STANDARD_HANDLE(OcctJni_Window, Aspect_Window)
#endif // OcctJni_Window_H

View File

@@ -0,0 +1,14 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-15

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -0,0 +1,166 @@
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/panel_main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<LinearLayout android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/linearLayout2">
<FrameLayout
android:id="@+id/submenu_group"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.opencascade.jnisample.OcctJniView
android:id="@+id/custom_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom|end" >
</com.opencascade.jnisample.OcctJniView>
<ImageButton
android:id="@+id/scroll_btn"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/close_p" />
<LinearLayout
android:id="@+id/panel_menu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/open"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:background="@color/btnColor"
android:src="@drawable/open" />
<ImageButton
android:id="@+id/fit"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:background="@color/btnColor"
android:src="@drawable/fit" />
<ImageButton
android:id="@+id/view"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:background="@color/btnColor"
android:src="@drawable/view" />
<ImageButton
android:id="@+id/info"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:background="@color/btnColor"
android:src="@drawable/info" />
<ImageButton
android:id="@+id/message"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:background="@color/btnColor"
android:src="@drawable/message" />
</LinearLayout>
<TextView
android:id="@+id/message_view"
android:background="@color/viewColor"
android:text="Message Log"
android:textSize="16px"
android:textStyle="bold"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/info_view"
android:background="@color/viewColor"
android:gravity="center"
android:text="info Log"
android:textSize="16px"
android:textStyle="bold"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/view_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:orientation="horizontal" >
<ImageButton
style="?android:borderlessButtonStyle"
android:background="@color/btnColor"
android:id="@+id/proj_front"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/proj_front"
android:layout_weight=".16"/>
<ImageButton
style="?android:borderlessButtonStyle"
android:background="@color/btnColor"
android:id="@+id/proj_top"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/proj_top"
android:layout_weight=".16"/>
<ImageButton
style="?android:borderlessButtonStyle"
android:background="@color/btnColor"
android:id="@+id/proj_left"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/proj_left"
android:layout_weight=".16"/>
<ImageButton
style="?android:borderlessButtonStyle"
android:background="@color/btnColor"
android:id="@+id/proj_back"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/proj_back"
android:layout_weight=".16"/>
<ImageButton
style="?android:borderlessButtonStyle"
android:background="@color/btnColor"
android:id="@+id/proj_bottom"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/proj_bottom"
android:layout_weight=".16"/>
<ImageButton
style="?android:borderlessButtonStyle"
android:background="@color/btnColor"
android:id="@+id/proj_right"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/proj_right"
android:layout_weight=".16"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TableLayout>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="open" type="id"/>
<item name="save" type="id"/>
<item name="screenshot" type="id"/>
<item name="mesh_none" type="id"/>
<item name="mesh_low_q" type="id"/>
<item name="mesh_norm_q" type="id"/>
<item name="mesh_high_q" type="id"/>
<item name="view1" type="id"/>
<item name="view2" type="id"/>
<item name="view3" type="id"/>
<item name="settings" type="id"/>
<item name="message" type="id"/>
<item name="lock" type="id"/>
<item name="info" type="id"/>
</resources>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">OpenCASCADE JNI Java Sample</string>
<color name="btnColor">#484848</color>
<color name="pressedBtnColor">#0099CC</color>
<color name="viewColor">#66252525</color>
<string-array name="ext_to_save">
<item>.png</item>
<item>.jpg</item>
</string-array>
<string-array name="ext_to_exp">
<item>.brep</item>
<item>.rle</item>
<item>.iges</item>
<item>.igs</item>
<item>.step</item>
<item>.stp</item>
</string-array>
<string name="wireframe_shading_title">wireframe/shading</string>
<string name="color_title">color</string>
<string name="material_title">material</string>
<string name="transparency_title">transparency</string>
<string name="hidden_lines_title">show/hide hidden lines</string>
<string name="info_html" formatted="false">
<![CDATA[
<p>OpenCASCADE JNI Java Sample</p>
<p>Simple viewer for BREP, STEP and IGES files.</p>
<p>Driven by Open CASCADE Technology %d.%d.%d.</p>
<p>Copyright 2014 OPEN CASCADE SAS.</p>
<p><img src="info_image"></p>
<p>http://www.opencascade.com</p>
<p>http://www.opencascade.org</p>
]]>
</string>
</resources>

View File

@@ -0,0 +1,778 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
package com.opencascade.jnisample;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.text.Spanned;
import android.util.TypedValue;
import android.view.Display;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
//! Main activity
public class OcctJniActivity extends Activity implements OnClickListener
{
//! Auxiliary method to print temporary info messages
public static void printShortInfo (Activity theActivity,
CharSequence theInfo)
{
Context aCtx = theActivity.getApplicationContext();
Toast aToast = Toast.makeText (aCtx, theInfo, Toast.LENGTH_LONG);
aToast.show();
}
//! Load single native library
private static boolean loadLibVerbose (String theLibName,
StringBuilder theLoadedInfo,
StringBuilder theFailedInfo)
{
try
{
System.loadLibrary (theLibName);
theLoadedInfo.append ("Info: native library \"");
theLoadedInfo.append (theLibName);
theLoadedInfo.append ("\" has been loaded\n");
return true;
}
catch (java.lang.UnsatisfiedLinkError theError)
{
theFailedInfo.append ("Error: native library \"");
theFailedInfo.append (theLibName);
theFailedInfo.append ("\" is unavailable:\n " + theError.getMessage());
return false;
}
catch (SecurityException theError)
{
theFailedInfo.append ("Error: native library \"");
theFailedInfo.append (theLibName);
theFailedInfo.append ("\" can not be loaded for security reasons:\n " + theError.getMessage());
return false;
}
}
public static boolean wasNativesLoadCalled = false;
public static boolean areNativeLoaded = false;
public static String nativeLoaded = "";
public static String nativeFailed = "";
//! Auxiliary method to load native libraries
public boolean loadNatives()
{
if (wasNativesLoadCalled)
{
return areNativeLoaded;
}
wasNativesLoadCalled = true;
StringBuilder aLoaded = new StringBuilder();
StringBuilder aFailed = new StringBuilder();
// copy OCCT resources
String aResFolder = getFilesDir().getAbsolutePath();
copyAssetFolder (getAssets(), "Shaders", aResFolder + "/Shaders");
copyAssetFolder (getAssets(), "SHMessage", aResFolder + "/SHMessage");
copyAssetFolder (getAssets(), "XSMessage", aResFolder + "/XSMessage");
copyAssetFolder (getAssets(), "TObj", aResFolder + "/TObj");
copyAssetFolder (getAssets(), "UnitsAPI", aResFolder + "/UnitsAPI");
// C++ runtime
loadLibVerbose ("gnustl_shared", aLoaded, aFailed);
// 3rd-parties
loadLibVerbose ("freetype", aLoaded, aFailed);
loadLibVerbose ("freeimage", aLoaded, aFailed);
if (// OCCT modeling
!loadLibVerbose ("TKernel", aLoaded, aFailed)
|| !loadLibVerbose ("TKMath", aLoaded, aFailed)
|| !loadLibVerbose ("TKG2d", aLoaded, aFailed)
|| !loadLibVerbose ("TKG3d", aLoaded, aFailed)
|| !loadLibVerbose ("TKGeomBase", aLoaded, aFailed)
|| !loadLibVerbose ("TKBRep", aLoaded, aFailed)
|| !loadLibVerbose ("TKGeomAlgo", aLoaded, aFailed)
|| !loadLibVerbose ("TKTopAlgo", aLoaded, aFailed)
|| !loadLibVerbose ("TKShHealing", aLoaded, aFailed)
|| !loadLibVerbose ("TKMesh", aLoaded, aFailed)
// exchange
|| !loadLibVerbose ("TKPrim", aLoaded, aFailed)
|| !loadLibVerbose ("TKBO", aLoaded, aFailed)
|| !loadLibVerbose ("TKBool", aLoaded, aFailed)
|| !loadLibVerbose ("TKFillet", aLoaded, aFailed)
|| !loadLibVerbose ("TKOffset", aLoaded, aFailed)
|| !loadLibVerbose ("TKXSBase", aLoaded, aFailed)
|| !loadLibVerbose ("TKIGES", aLoaded, aFailed)
|| !loadLibVerbose ("TKSTEPBase", aLoaded, aFailed)
|| !loadLibVerbose ("TKSTEPAttr", aLoaded, aFailed)
|| !loadLibVerbose ("TKSTEP209", aLoaded, aFailed)
|| !loadLibVerbose ("TKSTEP", aLoaded, aFailed)
// OCCT Visualization
|| !loadLibVerbose ("TKService", aLoaded, aFailed)
|| !loadLibVerbose ("TKHLR", aLoaded, aFailed)
|| !loadLibVerbose ("TKV3d", aLoaded, aFailed)
|| !loadLibVerbose ("TKOpenGl", aLoaded, aFailed)
// application code
|| !loadLibVerbose ("TKJniSample", aLoaded, aFailed))
{
nativeLoaded = aLoaded.toString();
nativeFailed = aFailed.toString();
areNativeLoaded = false;
//exitWithError (theActivity, "Broken apk?\n" + theFailedInfo);
return false;
}
nativeLoaded = aLoaded.toString();
areNativeLoaded = true;
return true;
}
//! Create activity
@Override protected void onCreate (Bundle theBundle)
{
super.onCreate (theBundle);
boolean isLoaded = loadNatives();
if (!isLoaded)
{
printShortInfo (this, nativeFailed);
OcctJniLogger.postMessage (nativeLoaded + "\n" + nativeFailed);
}
setContentView (R.layout.activity_main);
myOcctView = (OcctJniView )findViewById (R.id.custom_view);
myMessageTextView = (TextView )findViewById (R.id.message_view);
OcctJniLogger.setTextView (myMessageTextView);
createViewAndButtons (Configuration.ORIENTATION_LANDSCAPE);
myButtonPreferSize = defineButtonSize ((LinearLayout )findViewById (R.id.panel_menu));
ImageButton aScrollBtn = (ImageButton )findViewById (R.id.scroll_btn);
aScrollBtn.setY (myButtonPreferSize);
aScrollBtn.setOnTouchListener (new View.OnTouchListener()
{
@Override
public boolean onTouch (View theView, MotionEvent theEvent)
{
return onScrollBtnTouch (theView, theEvent);
}
});
onConfigurationChanged (getResources().getConfiguration());
Intent anIntent = getIntent();
Uri aDataUrl = anIntent != null ? anIntent.getData() : null;
String aDataPath = aDataUrl != null ? aDataUrl.getPath() : "";
myOcctView.open (aDataPath);
myLastPath = aDataPath;
}
//! Handle scroll events
private boolean onScrollBtnTouch (View theView,
MotionEvent theEvent)
{
switch (theEvent.getAction())
{
case MotionEvent.ACTION_DOWN:
{
LinearLayout aPanelMenu = (LinearLayout )findViewById (R.id.panel_menu);
boolean isLandscape = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
if (aPanelMenu.getVisibility() == View.VISIBLE)
{
aPanelMenu.setVisibility (View.GONE);
if (!isLandscape)
{
((ImageButton )theView).setImageResource (R.drawable.open_p);
theView.setY (0);
}
else
{
((ImageButton )theView).setImageResource (R.drawable.open_l);
theView.setX (0);
}
}
else
{
aPanelMenu.setVisibility (View.VISIBLE);
if (!isLandscape)
{
((ImageButton )theView).setImageResource (R.drawable.close_p);
theView.setY (myButtonPreferSize);
}
else
{
((ImageButton )theView).setImageResource (R.drawable.close_l);
theView.setX (myButtonPreferSize);
}
}
break;
}
}
return false;
}
//! Initialize views and buttons
private void createViewAndButtons (int theOrientation)
{
// open button
ImageButton anOpenButton = (ImageButton )findViewById (R.id.open);
anOpenButton.setOnClickListener (this);
// fit all
ImageButton aFitAllButton = (ImageButton )findViewById (R.id.fit);
aFitAllButton.setOnClickListener (this);
aFitAllButton.setOnTouchListener (new View.OnTouchListener()
{
@Override
public boolean onTouch (View theView, MotionEvent theEvent)
{
return onTouchButton (theView, theEvent);
}
});
// message
ImageButton aMessageButton = (ImageButton )findViewById (R.id.message);
aMessageButton.setOnClickListener (this);
// info
ImageButton anInfoButton = (ImageButton )findViewById (R.id.info);
anInfoButton.setOnClickListener (this);
// font for text view
TextView anInfoView = (TextView )findViewById (R.id.info_view);
anInfoView.setTextSize (TypedValue.COMPLEX_UNIT_SP, 18);
// add submenu buttons
createSubmenuBtn (R.id.view, R.id.view_group,
Arrays.asList (R.id.proj_front, R.id.proj_top, R.id.proj_left,
R.id.proj_back, R.id.proj_bottom, R.id.proj_right),
Arrays.asList (R.drawable.proj_front, R.drawable.proj_top, R.drawable.proj_left,
R.drawable.proj_back, R.drawable.proj_bottom, R.drawable.proj_right),
4);
}
@Override protected void onNewIntent (Intent theIntent)
{
super.onNewIntent (theIntent);
setIntent (theIntent);
}
@Override protected void onDestroy()
{
super.onDestroy();
OcctJniLogger.setTextView (null);
}
@Override protected void onPause()
{
super.onPause();
myOcctView.onPause();
}
@Override protected void onResume()
{
super.onResume();
myOcctView.onResume();
Intent anIntent = getIntent();
Uri aDataUrl = anIntent != null ? anIntent.getData() : null;
String aDataPath = aDataUrl != null ? aDataUrl.getPath() : "";
if (!aDataPath.equals (myLastPath))
{
myOcctView.open (aDataPath);
myLastPath = aDataPath;
}
}
//! Copy folder from assets
private boolean copyAssetFolder (AssetManager theAssetMgr,
String theAssetFolder,
String theFolderPathTo)
{
try
{
String[] aFiles = theAssetMgr.list (theAssetFolder);
File aFolder = new File (theFolderPathTo);
aFolder.mkdirs();
boolean isOk = true;
for (String aFileIter : aFiles)
{
if (aFileIter.contains ("."))
{
isOk &= copyAsset (theAssetMgr,
theAssetFolder + "/" + aFileIter,
theFolderPathTo + "/" + aFileIter);
}
else
{
isOk &= copyAssetFolder (theAssetMgr,
theAssetFolder + "/" + aFileIter,
theFolderPathTo + "/" + aFileIter);
}
}
return isOk;
}
catch (Exception theError)
{
theError.printStackTrace();
return false;
}
}
//! Copy single file from assets
private boolean copyAsset (AssetManager theAssetMgr,
String thePathFrom,
String thePathTo)
{
try
{
InputStream aStreamIn = theAssetMgr.open (thePathFrom);
File aFileTo = new File (thePathTo);
aFileTo.createNewFile();
OutputStream aStreamOut = new FileOutputStream (thePathTo);
copyStreamContent (aStreamIn, aStreamOut);
aStreamIn.close();
aStreamIn = null;
aStreamOut.flush();
aStreamOut.close();
aStreamOut = null;
return true;
}
catch (Exception theError)
{
theError.printStackTrace();
return false;
}
}
//! Copy single file
private static void copyStreamContent (InputStream theIn,
OutputStream theOut) throws IOException
{
byte[] aBuffer = new byte[1024];
int aNbReadBytes = 0;
while ((aNbReadBytes = theIn.read (aBuffer)) != -1)
{
theOut.write (aBuffer, 0, aNbReadBytes);
}
}
//! Show/hide text view
private void switchTextView (TextView theTextView,
ImageButton theClickedBtn,
boolean theToSwitchOn)
{
if (theTextView != null
&& theTextView.getVisibility() == View.GONE
&& theToSwitchOn)
{
theTextView.setVisibility (View.VISIBLE);
theClickedBtn.setBackgroundColor (getResources().getColor(R.color.pressedBtnColor));
setTextViewPosition (theTextView);
}
else
{
theTextView.setVisibility (View.GONE);
theClickedBtn.setBackgroundColor (getResources().getColor (R.color.btnColor));
}
}
//! Setup text view position
private void setTextViewPosition (TextView theTextView)
{
if (theTextView.getVisibility() != View.VISIBLE)
{
return;
}
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
theTextView.setX (myButtonPreferSize);
theTextView.setY (0);
}
else
{
theTextView.setX (0);
theTextView.setY (myButtonPreferSize);
}
}
@Override
public void onClick (View theButton)
{
ImageButton aClickedBtn = (ImageButton )theButton;
switch (aClickedBtn.getId())
{
case R.id.message:
{
switchTextView ((TextView )findViewById (R.id.info_view),
(ImageButton )findViewById (R.id.info), false);
switchTextView (myMessageTextView, aClickedBtn, true);
return;
}
case R.id.info:
{
String aText = getString (R.string.info_html);
aText = String.format (aText, cppOcctMajorVersion(), cppOcctMinorVersion(), cppOcctMicroVersion());
Spanned aSpanned = Html.fromHtml (aText, new ImageGetter()
{
@Override
public Drawable getDrawable (String theSource)
{
Resources aResources = getResources();
int anId = aResources.getIdentifier (theSource, "drawable", getPackageName());
Drawable aRes = aResources.getDrawable (anId);
aRes.setBounds (0, 0, aRes.getIntrinsicWidth(), aRes.getIntrinsicHeight());
return aRes;
}
}, null);
TextView anInfoView = (TextView )findViewById (R.id.info_view);
anInfoView.setText (aSpanned);
switchTextView (myMessageTextView, (ImageButton ) findViewById (R.id.message), false);
switchTextView (anInfoView, aClickedBtn, true);
return;
}
case R.id.fit:
{
myOcctView.fitAll();
return;
}
case R.id.proj_front:
{
myOcctView.setProj (OcctJniRenderer.TypeOfOrientation.Xpos);
return;
}
case R.id.proj_left:
{
myOcctView.setProj (OcctJniRenderer.TypeOfOrientation.Yneg);
return;
}
case R.id.proj_top:
{
myOcctView.setProj (OcctJniRenderer.TypeOfOrientation.Zpos);
return;
}
case R.id.proj_back:
{
myOcctView.setProj (OcctJniRenderer.TypeOfOrientation.Xneg);
return;
}
case R.id.proj_right:
{
myOcctView.setProj (OcctJniRenderer.TypeOfOrientation.Ypos);
return;
}
case R.id.proj_bottom:
{
myOcctView.setProj (OcctJniRenderer.TypeOfOrientation.Zneg);
return;
}
case R.id.open:
{
File aPath = Environment.getExternalStorageDirectory();
aClickedBtn.setBackgroundColor (getResources().getColor(R.color.pressedBtnColor));
if (myFileOpenDialog == null)
{
myFileOpenDialog = new OcctJniFileDialog (this, aPath);
myFileOpenDialog.setFileEndsWith (".brep");
myFileOpenDialog.setFileEndsWith (".rle");
myFileOpenDialog.setFileEndsWith (".iges");
myFileOpenDialog.setFileEndsWith (".igs");
myFileOpenDialog.setFileEndsWith (".step");
myFileOpenDialog.setFileEndsWith (".stp");
myFileOpenDialog.addFileListener (new OcctJniFileDialog.FileSelectedListener()
{
public void fileSelected (File theFile)
{
if (theFile != null && myOcctView != null)
{
myOcctView.open (theFile.getPath());
}
}
});
myFileOpenDialog.addDialogDismissedListener (new OcctJniFileDialog.DialogDismissedListener()
{
@Override
public void dialogDismissed()
{
ImageButton openButton = (ImageButton )findViewById (R.id.open);
openButton.setBackgroundColor (getResources().getColor(R.color.btnColor));
}
});
}
myFileOpenDialog.showDialog();
return;
}
}
}
private void createSubmenuBtn (int theParentBtnId,
int theParentLayoutId,
final List<Integer> theNewButtonIds,
final List<Integer> theNewButtonImageIds,
int thePosition)
{
int aPosInList = 0;
final ImageButton aParentBtn = (ImageButton )findViewById (theParentBtnId);
ViewGroup.LayoutParams aParams = null;
LinearLayout parentLayout = (LinearLayout ) findViewById (theParentLayoutId);
for (Integer newButtonId : theNewButtonIds)
{
ImageButton aNewButton = (ImageButton )findViewById (newButtonId);
if (aNewButton == null)
{
aNewButton = (ImageButton )new ImageButton (this);
aNewButton.setId (newButtonId);
aNewButton.setImageResource (theNewButtonImageIds.get (aPosInList));
aNewButton.setLayoutParams (aParams);
parentLayout.addView (aNewButton);
}
aNewButton.setOnClickListener (this);
aNewButton.setVisibility (View.GONE);
aNewButton.setOnTouchListener (new View.OnTouchListener()
{
@Override
public boolean onTouch (View theView, MotionEvent theEvent)
{
return onTouchButton (theView, theEvent);
}
});
++aPosInList;
}
if (aParentBtn != null)
{
aParentBtn.setOnTouchListener (null);
aParentBtn.setOnTouchListener (new View.OnTouchListener()
{
@Override
public boolean onTouch (View theView, MotionEvent theEvent)
{
if (theEvent.getAction () == MotionEvent.ACTION_DOWN)
{
Boolean isVisible = false;
for (Integer aNewButtonId : theNewButtonIds)
{
ImageButton anBtn = (ImageButton )findViewById (aNewButtonId);
if (anBtn != null)
{
if (anBtn.getVisibility() == View.GONE)
{
anBtn.setVisibility (View.VISIBLE);
isVisible = true;
}
else
{
anBtn.setVisibility (View.GONE);
}
}
}
aParentBtn.setBackgroundColor (!isVisible ? getResources().getColor(R.color.btnColor) : getResources().getColor(R.color.pressedBtnColor));
}
return false;
}
});
}
}
//! Implements onTouch functionality
private boolean onTouchButton (View theView,
MotionEvent theEvent)
{
switch (theEvent.getAction())
{
case MotionEvent.ACTION_DOWN:
((ImageButton )theView).setBackgroundColor (getResources().getColor (R.color.pressedBtnColor));
break;
case MotionEvent.ACTION_UP:
((ImageButton )theView).setBackgroundColor (getResources().getColor (R.color.btnColor));
break;
}
return false;
}
//! Handle configuration change event
@Override
public void onConfigurationChanged (Configuration theNewConfig)
{
super.onConfigurationChanged (theNewConfig);
LinearLayout aLayoutPanelMenu = (LinearLayout )findViewById (R.id.panel_menu);
LayoutParams aPanelMenuLayoutParams = aLayoutPanelMenu.getLayoutParams();
LinearLayout aLayoutViewGroup = (LinearLayout )findViewById (R.id.view_group);
LayoutParams aViewGroupLayoutParams = aLayoutViewGroup.getLayoutParams();
ImageButton aScrollBtn = (ImageButton )findViewById (R.id.scroll_btn);
LayoutParams aScrollBtnLayoutParams = aScrollBtn.getLayoutParams();
myButtonPreferSize = defineButtonSize ((LinearLayout )findViewById (R.id.panel_menu));
defineButtonSize ((LinearLayout )findViewById (R.id.view_group));
switch (theNewConfig.orientation)
{
case Configuration.ORIENTATION_PORTRAIT:
{
setHorizontal (aLayoutPanelMenu, aPanelMenuLayoutParams);
setHorizontal (aLayoutViewGroup, aViewGroupLayoutParams);
aLayoutViewGroup.setGravity (Gravity.BOTTOM);
aScrollBtnLayoutParams.height = LayoutParams.WRAP_CONTENT;
aScrollBtnLayoutParams.width = LayoutParams.MATCH_PARENT;
aScrollBtn.setLayoutParams (aScrollBtnLayoutParams);
if (aLayoutPanelMenu.getVisibility() == View.VISIBLE)
{
aScrollBtn.setImageResource (R.drawable.close_p);
aScrollBtn.setY (myButtonPreferSize);
aScrollBtn.setX (0);
}
else
{
aScrollBtn.setImageResource (R.drawable.open_p);
aScrollBtn.setY (0);
aScrollBtn.setX (0);
}
break;
}
case Configuration.ORIENTATION_LANDSCAPE:
{
setVertical (aLayoutPanelMenu, aPanelMenuLayoutParams);
setVertical (aLayoutViewGroup, aViewGroupLayoutParams);
aLayoutViewGroup.setGravity (Gravity.RIGHT);
aScrollBtnLayoutParams.height = LayoutParams.MATCH_PARENT;
aScrollBtnLayoutParams.width = LayoutParams.WRAP_CONTENT;
aScrollBtn.setLayoutParams (aScrollBtnLayoutParams);
if (aLayoutPanelMenu.getVisibility() == View.VISIBLE)
{
aScrollBtn.setImageResource (R.drawable.close_l);
aScrollBtn.setX (myButtonPreferSize);
aScrollBtn.setY (0);
}
else
{
aScrollBtn.setImageResource (R.drawable.open_l);
aScrollBtn.setY (0);
aScrollBtn.setX (0);
}
break;
}
}
setTextViewPosition (myMessageTextView);
setTextViewPosition ((TextView )findViewById (R.id.info_view));
}
private void setHorizontal (LinearLayout theLayout,
LayoutParams theLayoutParams)
{
theLayout.setOrientation (LinearLayout.HORIZONTAL);
theLayoutParams.height = LayoutParams.WRAP_CONTENT;
theLayoutParams.width = LayoutParams.MATCH_PARENT;
theLayout.setLayoutParams (theLayoutParams);
}
private void setVertical (LinearLayout theLayout,
LayoutParams theLayoutParams)
{
theLayout.setOrientation (LinearLayout.VERTICAL);
theLayoutParams.height = LayoutParams.MATCH_PARENT;
theLayoutParams.width = LayoutParams.WRAP_CONTENT;
theLayout.setLayoutParams (theLayoutParams);
}
//! Define button size
private int defineButtonSize (LinearLayout theLayout)
{
boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
Display aDisplay = getWindowManager().getDefaultDisplay();
Point aDispPnt = new Point();
aDisplay.getSize (aDispPnt);
int aNbChildren = theLayout.getChildCount();
int aHeight = aDispPnt.y / aNbChildren;
int aWidth = aDispPnt.x / aNbChildren;
int aResultSize = 0;
for (int aChildIter = 0; aChildIter < aNbChildren; ++aChildIter)
{
View aView = theLayout.getChildAt (aChildIter);
if (aView instanceof ImageButton)
{
ImageButton aButton = (ImageButton )aView;
if (isLandscape)
{
aButton.setMinimumWidth (aHeight);
}
else
{
aButton.setMinimumHeight (aWidth);
}
}
}
if (isLandscape)
{
aResultSize = aHeight;
}
else
{
aResultSize = aWidth;
}
return aResultSize;
}
//! OCCT major version
private native long cppOcctMajorVersion();
//! OCCT minor version
private native long cppOcctMinorVersion();
//! OCCT micro version
private native long cppOcctMicroVersion();
private OcctJniView myOcctView;
private TextView myMessageTextView;
private String myLastPath;
private OcctJniFileDialog myFileOpenDialog;
private int myButtonPreferSize = 65;
}

View File

@@ -0,0 +1,376 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
package com.opencascade.jnisample;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.opencascade.jnisample.ListenerList.FireHandler;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Environment;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
//! Simple open file dialog
public class OcctJniFileDialog
{
public enum DialogMode
{
FileOpen, FileExport, FileSave
}
private static final String PARENT_DIR = "..";
private String[] myFileList;
private File myCurrentPath;
private DialogMode myDialogMode = DialogMode.FileOpen;
private ListenerList<FileSelectedListener> myFileListenerList = new ListenerList<OcctJniFileDialog.FileSelectedListener>();
private ListenerList<DialogDismissedListener> myDialogDismissedList = new ListenerList<DialogDismissedListener>();
private final Activity myActivity;
private List<String> myFileEndsWith;
private EditText myFileNameInput;
private Spinner myFileExtSpinner;
int myCurrentExtPositionInList = 0;
public interface FileSelectedListener
{
void fileSelected (File theFile);
}
public interface DialogDismissedListener
{
void dialogDismissed();
}
//! Main constructor.
public OcctJniFileDialog (Activity theActivity,
File thePath)
{
myActivity = theActivity;
if (!thePath.exists())
{
thePath = Environment.getExternalStorageDirectory();
}
loadFileList (thePath);
}
//! Create new dialog
public Dialog createFileDialog()
{
final Object[] anObjWrapper = new Object[1];
Dialog aDialog = null;
AlertDialog.Builder aBuilder = new AlertDialog.Builder (myActivity);
aBuilder.setTitle (myCurrentPath.getPath());
LinearLayout aTitleLayout = new LinearLayout (myActivity);
aTitleLayout.setLayoutParams (new LinearLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
aTitleLayout.setOrientation (LinearLayout.VERTICAL);
ListView list = new ListView (myActivity);
list.setScrollingCacheEnabled(false);
list.setBackgroundColor (Color.parseColor ("#33B5E5"));
list.setAdapter (new ArrayAdapter<String> (myActivity, android.R.layout.select_dialog_item, myFileList));
list.setOnItemClickListener (new AdapterView.OnItemClickListener ()
{
public void onItemClick (AdapterView<?> arg0, View view, int pos, long id)
{
String fileChosen = myFileList[pos];
File aChosenFile = getChosenFile (fileChosen);
if (aChosenFile.isDirectory())
{
loadFileList (aChosenFile);
((Dialog )anObjWrapper[0]).cancel();
((Dialog )anObjWrapper[0]).dismiss();
showDialog();
}
else
{
if (myDialogMode == DialogMode.FileOpen)
{
((Dialog )anObjWrapper[0]).cancel();
((Dialog )anObjWrapper[0]).dismiss();
fireFileSelectedEvent (aChosenFile);
}
else
{
myFileNameInput.setText (aChosenFile.getName());
}
}
}
});
list.setLayoutParams (new LinearLayout.LayoutParams (LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 0.6f));
aTitleLayout.addView (list);
if (myDialogMode == DialogMode.FileSave
|| myDialogMode == DialogMode.FileExport)
{
myFileNameInput = new EditText (myActivity);
myFileExtSpinner = new Spinner (myActivity);
ArrayAdapter<CharSequence> adapter = null;
if (myDialogMode == DialogMode.FileExport)
{
adapter = ArrayAdapter.createFromResource (myActivity, R.array.ext_to_exp,
android.R.layout.simple_spinner_item);
}
else
{
adapter = ArrayAdapter.createFromResource (myActivity, R.array.ext_to_save,
android.R.layout.simple_spinner_item);
}
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource (android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
myFileExtSpinner.setAdapter (adapter);
myFileExtSpinner.setSelection (myCurrentExtPositionInList);
myFileExtSpinner.setOnItemSelectedListener (new AdapterView.OnItemSelectedListener()
{
@Override
public void onNothingSelected (AdapterView<?> theParentView)
{
// your code here
}
@Override
public void onItemSelected (AdapterView<?> theParent, View theView, int thePosition, long theId)
{
if (myCurrentExtPositionInList != thePosition)
{
myCurrentExtPositionInList = thePosition;
setFileEndsWith (Arrays.asList (myFileExtSpinner.getSelectedItem().toString()));
loadFileList (myCurrentPath);
((Dialog )anObjWrapper[0]).cancel();
((Dialog )anObjWrapper[0]).dismiss();
showDialog();
}
}
});
myFileExtSpinner.setLayoutParams (new LinearLayout.LayoutParams (LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT, 0.2f));
// titleLayout.addView(fileExtSpinner);
myFileNameInput.setLayoutParams (new LinearLayout.LayoutParams (LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT, 0.2f));
LinearLayout aControlsView = new LinearLayout (myActivity);
aControlsView.addView (myFileNameInput);
aControlsView.addView (myFileExtSpinner);
aTitleLayout.addView (aControlsView);
aBuilder.setView (aTitleLayout);
aBuilder.setPositiveButton ("OK", new DialogInterface.OnClickListener()
{
@Override
public void onClick (DialogInterface theDialog, int theWhich)
{
if (theWhich >= 0)
{
String aFileChosen = myFileList[theWhich];
File aChosenFile = getChosenFile (aFileChosen);
fireFileSelectedEvent (aChosenFile);
}
}
}).setNegativeButton ("Cancel", null);
}
else
{
aBuilder.setNegativeButton ("Cancel", null);
}
aBuilder.setView (aTitleLayout);
aDialog = aBuilder.show();
aDialog.setOnDismissListener (new DialogInterface.OnDismissListener()
{
@Override
public void onDismiss (DialogInterface theDialog)
{
fireDialogDismissedEvent();
}
});
anObjWrapper[0] = aDialog;
return aDialog;
}
public void addFileListener (FileSelectedListener theListener)
{
myFileListenerList.add (theListener);
}
public void addDialogDismissedListener (DialogDismissedListener theListener)
{
myDialogDismissedList.add (theListener);
}
//! Show file dialog
public void showDialog()
{
createFileDialog().show();
}
private void fireFileSelectedEvent (final File theFile)
{
myFileListenerList.fireEvent (new FireHandler<OcctJniFileDialog.FileSelectedListener>()
{
public void fireEvent (FileSelectedListener theListener)
{
theListener.fileSelected (theFile);
}
});
}
private void fireDialogDismissedEvent()
{
myDialogDismissedList.fireEvent (new FireHandler<OcctJniFileDialog.DialogDismissedListener>()
{
public void fireEvent (DialogDismissedListener theListener)
{
theListener.dialogDismissed();
}
});
}
private void loadFileList (File thePath)
{
myCurrentPath = thePath;
List<String> aList = new ArrayList<String>();
if (thePath.exists())
{
if (thePath.getParentFile() != null)
{
aList.add (PARENT_DIR);
}
FilenameFilter aFilter = new FilenameFilter()
{
public boolean accept (File theDir, String theFilename)
{
File aSel = new File (theDir, theFilename);
if (!aSel.canRead())
{
return false;
}
boolean isEndWith = false;
if (myFileEndsWith != null)
{
for (String aFileExtIter : myFileEndsWith)
{
if (theFilename.toLowerCase().endsWith (aFileExtIter))
{
isEndWith = true;
break;
}
}
}
return isEndWith || aSel.isDirectory();
}
};
String[] aFileList1 = thePath.list (aFilter);
if (aFileList1 != null)
{
for (String aFileIter : aFileList1)
{
aList.add (aFileIter);
}
}
}
myFileList = (String[] )aList.toArray (new String[] {});
}
private File getChosenFile (String theFileChosen)
{
if (theFileChosen.equals (PARENT_DIR))
return myCurrentPath.getParentFile();
else
return new File (myCurrentPath, theFileChosen);
}
public void setFileEndsWith (String fileEndsWith)
{
if (myFileEndsWith == null)
{
myFileEndsWith = new ArrayList<String>();
}
if (myFileEndsWith.indexOf (fileEndsWith) == -1)
{
myFileEndsWith.add (fileEndsWith);
}
}
public void setFileEndsWith (List<String> theFileEndsWith)
{
myFileEndsWith = theFileEndsWith;
}
public DialogMode DialogMode()
{
return myDialogMode;
}
public void DialogMode (DialogMode theMode)
{
myDialogMode = theMode;
}
}
class ListenerList<L>
{
private List<L> myListenerList = new ArrayList<L>();
public interface FireHandler<L>
{
void fireEvent (L theListener);
}
public void add (L theListener)
{
myListenerList.add (theListener);
}
public void fireEvent (FireHandler<L> theFireHandler)
{
List<L> aCopy = new ArrayList<L> (myListenerList);
for (L anIter : aCopy)
{
theFireHandler.fireEvent (anIter);
}
}
public void remove (L theListener)
{
myListenerList.remove (theListener);
}
public List<L> getListenerList()
{
return myListenerList;
}
}

View File

@@ -0,0 +1,71 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
package com.opencascade.jnisample;
import java.util.concurrent.locks.ReentrantLock;
import android.util.Log;
import android.widget.TextView;
//! Auxiliary class for logging messages
public class OcctJniLogger
{
//! Setup text view
public static void setTextView (TextView theTextView)
{
if (myTextView != null)
{
myLog = myTextView.getText().toString();
}
myTextView = theTextView;
if (myTextView != null)
{
myTextView.setText (myLog);
myLog = "";
}
}
//! Interface implementation
public static void postMessage (String theText)
{
final String aCopy = new String (theText);
Log.e (myTag, theText);
myMutex.lock();
final TextView aView = myTextView;
if (aView == null)
{
myLog += aCopy;
myMutex.unlock();
return;
}
aView.post (new Runnable()
{
public void run()
{
aView.setText (aView.getText() + aCopy + "\n");
}
});
myMutex.unlock();
}
private static final String myTag = "occtJniViewer";
private static final ReentrantLock myMutex = new ReentrantLock (true);
private static TextView myTextView = null;
private static String myLog = "";
}

View File

@@ -0,0 +1,218 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
package com.opencascade.jnisample;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView;
//! Wrapper for C++ OCCT viewer.
public class OcctJniRenderer implements GLSurfaceView.Renderer
{
//! Wrapper for V3d_TypeOfOrientation
enum TypeOfOrientation
{
Xpos, // front
Ypos, // left
Zpos, // top
Xneg, // back
Yneg, // right
Zneg // bottom
};
//! Empty constructor.
OcctJniRenderer()
{
if (OcctJniActivity.areNativeLoaded)
{
myCppViewer = cppCreate();
}
}
//! Open file.
public void open (String thePath)
{
if (myCppViewer != 0)
{
cppOpen (myCppViewer, thePath);
}
}
//! Update viewer.
public void onDrawFrame (GL10 theGl)
{
if (myCppViewer != 0)
{
cppRedraw (myCppViewer);
}
}
//! (re)initialize viewer.
public void onSurfaceChanged (GL10 theGl, int theWidth, int theHeight)
{
if (myCppViewer != 0)
{
cppResize (myCppViewer, theWidth, theHeight);
}
}
public void onSurfaceCreated (GL10 theGl, EGLConfig theEglConfig)
{
if (myCppViewer != 0)
{
cppInit (myCppViewer);
}
}
//! Initialize rotation (remember first point position)
public void onStartRotation (int theStartX, int theStartY)
{
if (myCppViewer != 0)
{
cppStartRotation (myCppViewer, theStartX, theStartY);
}
}
//! Perform rotation (relative to first point)
public void onRotation (int theX, int theY)
{
if (myCppViewer != 0)
{
cppOnRotation (myCppViewer, theX, theY);
}
}
//! Perform panning
public void onPanning (int theDX, int theDY)
{
if (myCppViewer != 0)
{
cppOnPanning (myCppViewer, theDX, theDY);
}
}
//! Perform selection
public void onClick (int theX, int theY)
{
if (myCppViewer != 0)
{
cppOnClick (myCppViewer, theX, theY);
}
}
//! Stop previously active action (e.g. discard first rotation point)
public void onStopAction()
{
if (myCppViewer != 0)
{
cppStopAction (myCppViewer);
}
}
//! Fit All
public void fitAll()
{
if (myCppViewer != 0)
{
cppFitAll (myCppViewer);
}
}
//! Move camera
public void setProj (TypeOfOrientation theProj)
{
if (myCppViewer == 0)
{
return;
}
switch (theProj)
{
case Xpos: cppSetXposProj (myCppViewer); break;
case Ypos: cppSetYposProj (myCppViewer); break;
case Zpos: cppSetZposProj (myCppViewer); break;
case Xneg: cppSetXnegProj (myCppViewer); break;
case Yneg: cppSetYnegProj (myCppViewer); break;
case Zneg: cppSetZnegProj (myCppViewer); break;
}
}
//! Post message to the text view.
public void postMessage (String theText)
{
OcctJniLogger.postMessage (theText);
}
//! Create instance of C++ class
private native long cppCreate();
//! Destroy instance of C++ class
private native void cppDestroy (long theCppPtr);
//! Initialize OCCT viewer (steal OpenGL ES context bound to this thread)
private native void cppInit (long theCppPtr);
//! Resize OCCT viewer
private native void cppResize (long theCppPtr, int theWidth, int theHeight);
//! Open CAD file
private native void cppOpen (long theCppPtr, String thePath);
//! Handle detection in the viewer
private native void cppMoveTo (long theCppPtr, int theX, int theY);
//! Redraw OCCT viewer
private native void cppRedraw (long theCppPtr);
//! Fit All
private native void cppFitAll (long theCppPtr);
//! Move camera
private native void cppSetXposProj (long theCppPtr);
//! Move camera
private native void cppSetYposProj (long theCppPtr);
//! Move camera
private native void cppSetZposProj (long theCppPtr);
//! Move camera
private native void cppSetXnegProj (long theCppPtr);
//! Move camera
private native void cppSetYnegProj (long theCppPtr);
//! Move camera
private native void cppSetZnegProj (long theCppPtr);
//! Initialize rotation
private native void cppStartRotation (long theCppPtr, int theStartX, int theStartY);
//! Perform rotation
private native void cppOnRotation (long theCppPtr, int theX, int theY);
//! Perform panning
private native void cppOnPanning (long theCppPtr, int theDX, int theDY);
//! Perform selection
private native void cppOnClick (long theCppPtr, int theX, int theY);
//! Stop action (rotation / panning / scaling)
private native void cppStopAction (long theCppPtr);
private long myCppViewer = 0; //!< pointer to c++ class instance
}

View File

@@ -0,0 +1,332 @@
// Copyright (c) 2014 OPEN CASCADE SAS
//
// 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 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.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
package com.opencascade.jnisample;
import android.app.ActionBar.LayoutParams;
import android.content.Context;
import android.graphics.PointF;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.widget.RelativeLayout;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
//! OpenGL ES 2.0+ view.
//! Performs rendering in parallel thread.
class OcctJniView extends GLSurfaceView
{
// ! Default constructor.
public OcctJniView (Context theContext,
AttributeSet theAttrs)
{
super (theContext, theAttrs);
setPreserveEGLContextOnPause (true);
setEGLContextFactory (new ContextFactory());
setEGLConfigChooser (new ConfigChooser());
RelativeLayout.LayoutParams aLParams = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
aLParams.addRule (RelativeLayout.ALIGN_TOP);
myRenderer = new OcctJniRenderer();
setRenderer (myRenderer);
}
//! Open file.
public void open (String thePath)
{
final String aPath = thePath;
queueEvent (new Runnable() { public void run() { myRenderer.open (aPath); }});
}
//! Create OpenGL ES 2.0+ context
private static class ContextFactory implements GLSurfaceView.EGLContextFactory
{
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
public EGLContext createContext (EGL10 theEgl,
EGLDisplay theEglDisplay,
EGLConfig theEglConfig)
{
if (theEglConfig == null)
{
return null;
}
// reset EGL errors stack
int anError = EGL10.EGL_SUCCESS;
while ((anError = theEgl.eglGetError()) != EGL10.EGL_SUCCESS) {}
int[] anAttribs = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
EGLContext aEglContext = theEgl.eglCreateContext (theEglDisplay, theEglConfig, EGL10.EGL_NO_CONTEXT, anAttribs);
while ((anError = theEgl.eglGetError()) != EGL10.EGL_SUCCESS)
{
OcctJniLogger.postMessage ("Error: eglCreateContext() " + String.format ("0x%x", anError));
}
return aEglContext;
}
public void destroyContext (EGL10 theEgl,
EGLDisplay theEglDisplay,
EGLContext theEglContext)
{
theEgl.eglDestroyContext (theEglDisplay, theEglContext);
}
}
//! Search for RGB24 config with depth and stencil buffers
private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser
{
//! Reset EGL errors stack
private void popEglErrors (EGL10 theEgl)
{
int anError = EGL10.EGL_SUCCESS;
while ((anError = theEgl.eglGetError()) != EGL10.EGL_SUCCESS)
{
OcctJniLogger.postMessage ("EGL Error: " + String.format ("0x%x", anError));
}
}
//! Auxiliary method to dump EGL configuration - for debugging purposes
@SuppressWarnings("unused")
private void printConfig (EGL10 theEgl,
EGLDisplay theEglDisplay,
EGLConfig theEglConfig)
{
int[] THE_ATTRIBS =
{
EGL10.EGL_BUFFER_SIZE, EGL10.EGL_ALPHA_SIZE, EGL10.EGL_BLUE_SIZE, EGL10.EGL_GREEN_SIZE, EGL10.EGL_RED_SIZE, EGL10.EGL_DEPTH_SIZE, EGL10.EGL_STENCIL_SIZE,
EGL10.EGL_CONFIG_CAVEAT,
EGL10.EGL_CONFIG_ID,
EGL10.EGL_LEVEL,
EGL10.EGL_MAX_PBUFFER_HEIGHT, EGL10.EGL_MAX_PBUFFER_PIXELS, EGL10.EGL_MAX_PBUFFER_WIDTH,
EGL10.EGL_NATIVE_RENDERABLE, EGL10.EGL_NATIVE_VISUAL_ID, EGL10.EGL_NATIVE_VISUAL_TYPE,
0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
EGL10.EGL_SAMPLES, EGL10.EGL_SAMPLE_BUFFERS,
EGL10.EGL_SURFACE_TYPE,
EGL10.EGL_TRANSPARENT_TYPE, EGL10.EGL_TRANSPARENT_RED_VALUE, EGL10.EGL_TRANSPARENT_GREEN_VALUE, EGL10.EGL_TRANSPARENT_BLUE_VALUE,
0x3039, 0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGB, EGL10.EGL_BIND_TO_TEXTURE_RGBA,
0x303B, 0x303C, // EGL10.EGL_MIN_SWAP_INTERVAL, EGL10.EGL_MAX_SWAP_INTERVAL
EGL10.EGL_LUMINANCE_SIZE, EGL10.EGL_ALPHA_MASK_SIZE,
EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RENDERABLE_TYPE,
0x3042 // EGL10.EGL_CONFORMANT
};
String[] THE_NAMES =
{
"EGL_BUFFER_SIZE", "EGL_ALPHA_SIZE", "EGL_BLUE_SIZE", "EGL_GREEN_SIZE", "EGL_RED_SIZE", "EGL_DEPTH_SIZE", "EGL_STENCIL_SIZE",
"EGL_CONFIG_CAVEAT",
"EGL_CONFIG_ID",
"EGL_LEVEL",
"EGL_MAX_PBUFFER_HEIGHT", "EGL_MAX_PBUFFER_PIXELS", "EGL_MAX_PBUFFER_WIDTH",
"EGL_NATIVE_RENDERABLE", "EGL_NATIVE_VISUAL_ID", "EGL_NATIVE_VISUAL_TYPE",
"EGL_PRESERVED_RESOURCES",
"EGL_SAMPLES", "EGL_SAMPLE_BUFFERS",
"EGL_SURFACE_TYPE",
"EGL_TRANSPARENT_TYPE", "EGL_TRANSPARENT_RED_VALUE", "EGL_TRANSPARENT_GREEN_VALUE", "EGL_TRANSPARENT_BLUE_VALUE",
"EGL_BIND_TO_TEXTURE_RGB", "EGL_BIND_TO_TEXTURE_RGBA",
"EGL_MIN_SWAP_INTERVAL", "EGL_MAX_SWAP_INTERVAL",
"EGL_LUMINANCE_SIZE", "EGL_ALPHA_MASK_SIZE",
"EGL_COLOR_BUFFER_TYPE", "EGL_RENDERABLE_TYPE",
"EGL_CONFORMANT"
};
int[] aValue = new int[1];
for (int anAttrIter = 0; anAttrIter < THE_ATTRIBS.length; ++anAttrIter)
{
int anAttr = THE_ATTRIBS[anAttrIter];
String aName = THE_NAMES [anAttrIter];
if (theEgl.eglGetConfigAttrib (theEglDisplay, theEglConfig, anAttr, aValue))
{
OcctJniLogger.postMessage (String.format (" %s: %d\n", aName, aValue[0]));
}
else
{
popEglErrors (theEgl);
}
}
}
//! Interface implementation
public EGLConfig chooseConfig (EGL10 theEgl,
EGLDisplay theEglDisplay)
{
int EGL_OPENGL_ES2_BIT = 4;
int[] aCfgAttribs =
{
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_ALPHA_SIZE, 0,
EGL10.EGL_DEPTH_SIZE, 24,
EGL10.EGL_STENCIL_SIZE, 8,
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL10.EGL_NONE
};
EGLConfig aConfigs[] = new EGLConfig[1];
int[] aNbConfigs = new int[1];
if (!theEgl.eglChooseConfig (theEglDisplay, aCfgAttribs, aConfigs, 1, aNbConfigs)
|| aConfigs[0] == null)
{
aCfgAttribs[4 * 2 + 1] = 16; // try config with smaller depth buffer
popEglErrors (theEgl);
if (!theEgl.eglChooseConfig (theEglDisplay, aCfgAttribs, aConfigs, 1, aNbConfigs)
|| aConfigs[0] == null)
{
OcctJniLogger.postMessage ("Error: eglChooseConfig() has failed!");
return null;
}
}
//printConfig (theEgl, theEglDisplay, aConfigs[0]);
return aConfigs[0];
}
}
//! Callback to handle touch events
@Override public boolean onTouchEvent (MotionEvent theEvent)
{
int aPointerIndex = theEvent.getActionIndex();
int aPointerId = theEvent.getPointerId (aPointerIndex);
int aMaskedAction = theEvent.getActionMasked();
switch (aMaskedAction)
{
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
{
PointF aPntLast = null;
if (myActivePointers.size() >= 1)
{
aPntLast = myActivePointers.get (myActivePointers.keyAt (0));
}
final PointF aPnt = new PointF();
aPnt.x = theEvent.getX (aPointerIndex);
aPnt.y = theEvent.getY (aPointerIndex);
myActivePointers.put (aPointerId, aPnt);
switch (myActivePointers.size())
{
case 1:
{
final int aStartX = (int )aPnt.x;
final int aStartY = (int )aPnt.y;
queueEvent (new Runnable() { public void run() { myRenderer.onStartRotation (aStartX, aStartY); }});
break;
}
case 2:
{
myPanFrom.x = (aPntLast.x + aPnt.x) * 0.5f;
myPanFrom.y = (aPntLast.y + aPnt.y) * 0.5f;
break;
}
}
break;
}
case MotionEvent.ACTION_MOVE:
{
for (int aNbPointers = theEvent.getPointerCount(), aPntIter = 0; aPntIter < aNbPointers; ++aPntIter)
{
PointF aPnt = myActivePointers.get (theEvent.getPointerId (aPntIter));
if (aPnt != null)
{
aPnt.x = theEvent.getX (aPntIter);
aPnt.y = theEvent.getY (aPntIter);
}
}
switch (myActivePointers.size())
{
case 1:
{
PointF aPnt = myActivePointers.get (theEvent.getPointerId (0));
final int anX = (int )aPnt.x;
final int anY = (int )aPnt.y;
queueEvent (new Runnable() { public void run() { myRenderer.onRotation (anX, anY); }});
break;
}
case 2:
{
PointF aPnt1 = myActivePointers.get (myActivePointers.keyAt (0));
PointF aPnt2 = myActivePointers.get (myActivePointers.keyAt (1));
PointF aPntAver = new PointF ((aPnt1.x + aPnt2.x) * 0.5f,
(aPnt1.y + aPnt2.y) * 0.5f);
final int aDX = (int )(aPntAver.x - myPanFrom.x);
final int aDY = (int )(myPanFrom.y -aPntAver.y);
myPanFrom.x = aPntAver.x;
myPanFrom.y = aPntAver.y;
queueEvent (new Runnable() { public void run() { myRenderer.onPanning (aDX, aDY); }});
}
}
break;
}
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_CANCEL:
{
myActivePointers.remove (aPointerId);
if (myActivePointers.size() == 0)
{
final int aPressX = (int )theEvent.getX (aPointerIndex);
final int aPressY = (int )theEvent.getY (aPointerIndex);
double aPressTimeMs = theEvent.getEventTime() - theEvent.getDownTime();
if (aPressTimeMs < 100.0)
{
queueEvent (new Runnable() { public void run() { myRenderer.onClick (aPressX, aPressY); }});
break;
}
}
else if (myActivePointers.size() == 1)
{
PointF aPnt = myActivePointers.get (myActivePointers.keyAt (0));
final int aStartX = (int )aPnt.x;
final int aStartY = (int )aPnt.y;
queueEvent (new Runnable() { public void run() { myRenderer.onStartRotation (aStartX, aStartY); }});
}
//queueEvent (new Runnable() { public void run() { myRenderer.onStopAction(); }});
break;
}
}
///invalidate();
return true;
}
//! Fit All
public void fitAll()
{
queueEvent (new Runnable() { public void run() { myRenderer.fitAll(); }});
}
//! Move camera
public void setProj (final OcctJniRenderer.TypeOfOrientation theProj)
{
queueEvent (new Runnable() { public void run() { myRenderer.setProj (theProj); }});
}
//! OCCT viewer
private OcctJniRenderer myRenderer = null;
//! Touch events cache
private SparseArray<PointF> myActivePointers = new SparseArray<PointF>();
//! Starting point for panning event
private PointF myPanFrom = new PointF (0.0f, 0.0f);
}

View File

@@ -6,6 +6,7 @@ add_definitions (-DWINVER=0x0501 -DUNICODE -D_UNICODE)
set (CMAKE_MFC_FLAG 2)
set (Viewer3d_SRC_DIR ${MFC_STANDARD_SAMPLES_DIR}/04_Viewer3d/src)
set (Viewer3d_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/04_Viewer3d/res)
set (Viewer3d_HEADER_FILES ${Viewer3d_SRC_DIR}/BoxRadius.h
${Viewer3d_SRC_DIR}/DlgIsos.h
${Viewer3d_SRC_DIR}/ISession_Curve.h
@@ -23,8 +24,8 @@ set (Viewer3d_HEADER_FILES ${Viewer3d_SRC_DIR}/BoxRadius.h
${Viewer3d_SRC_DIR}/ZClippingDlg.h
${Viewer3d_SRC_DIR}/ZCueingDlg.h
${Viewer3d_SRC_DIR}/State.h
${Viewer3d_SRC_DIR}/resource.h
${Viewer3d_SRC_DIR}/resource.hm)
${Viewer3d_RESOURCE_DIR}/resource.h
${Viewer3d_RESOURCE_DIR}/resource.hm)
set (Viewer3d_SOURCE_FILES ${Viewer3d_SRC_DIR}/BoxRadius.cpp
${Viewer3d_SRC_DIR}/DlgIsos.cpp
${Viewer3d_SRC_DIR}/ISession_Curve.cpp
@@ -42,9 +43,8 @@ set (Viewer3d_SOURCE_FILES ${Viewer3d_SRC_DIR}/BoxRadius.cpp
${Viewer3d_SRC_DIR}/ZClippingDlg.cpp
${Viewer3d_SRC_DIR}/ZCueingDlg.cpp)
set (Viewer3d_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/04_Viewer3d/res)
set (Viewer3d_RESOURCE_FILES ${Viewer3d_SRC_DIR}/Viewer3d.rc
${Viewer3d_SRC_DIR}/AISToolbar.bmp
set (Viewer3d_RESOURCE_FILES ${Viewer3d_RESOURCE_DIR}/Viewer3d.rc
${Viewer3d_RESOURCE_DIR}/AISToolbar.bmp
${Viewer3d_RESOURCE_DIR}/AIS_TB.bmp
${Viewer3d_RESOURCE_DIR}/Toolbar.bmp)

View File

@@ -836,7 +836,7 @@ IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfS
CFileSaveSTEPDialog aDlg(NULL);
aDlg.m_Cc1ModelType = STEPControl_ManifoldSolidBrep;
aDlg.m_Cc1ModelType = STEPControl_AsIs;
if (aDlg.DoModal() == IDOK) {
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));

View File

@@ -86,7 +86,7 @@ public :
static IFSelect_ReturnStatus SaveSTEP(const Standard_CString& aFileName,
const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape,
const STEPControl_StepModelType aValue = STEPControl_ManifoldSolidBrep);
const STEPControl_StepModelType aValue = STEPControl_AsIs);
static void ReadSAT(const Handle(AIS_InteractiveContext)& anInteractiveContext);
static Handle(TopTools_HSequenceOfShape) ReadSAT(); // not by reference --> the sequence is created here !!

View File

@@ -14,7 +14,12 @@
CFileSaveCSFDBDialog::CFileSaveCSFDBDialog(CWnd* pParent /*=NULL*/)
: CFileDialog(FALSE,_T("*.csfdb"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
_T("CSFDB Files (*.csfdb)|*.csfdb;|CSFDB Files (*.csf)|*.csf;||"),
pParent)
pParent
#if (_MSC_VER < 1500)
)
#else
,0,0)
#endif
{
//{{AFX_DATA_INIT(CFileSaveCSFDBDialog)

View File

@@ -12,15 +12,19 @@
CFileSaveSTEPDialog::CFileSaveSTEPDialog(CWnd* pParent /*=NULL*/)
: CFileDialog(FALSE,_T("*.STEP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
_T("STEP Files (*.step)|*.step;|STEP Files (*.stp)|*.stp;||"),
pParent)
pParent
#if (_MSC_VER < 1500)
)
#else
,0,0)
#endif
//dlg.m_ofn.lpstrInitialDir = initdir;
{
//{{AFX_DATA_INIT(CFileSaveSTEPDialog)
m_Cc1ModelType = STEPControl_ManifoldSolidBrep;
m_Cc1ModelType = STEPControl_AsIs;
//}}AFX_DATA_INIT
CString CASROOTValue;
@@ -35,34 +39,21 @@ CString initdir = (CASROOTValue + "\\..\\data\\step");
void CFileSaveSTEPDialog::DoDataExchange(CDataExchange* pDX)
{
CFileDialog::DoDataExchange(pDX);
if (!pDX->m_bSaveAndValidate)
{
CFileDialog::DoDataExchange(pDX);
if (!pDX->m_bSaveAndValidate)
{
m_DialogType = m_Cc1ModelType;
}
if (m_Cc1ModelType==STEPControl_ManifoldSolidBrep) m_DialogType=0;
if (m_Cc1ModelType==STEPControl_BrepWithVoids) Standard_Failure::Raise("unsupported enumeration terme");
if (m_Cc1ModelType==STEPControl_FacetedBrep) m_DialogType=1;
if (m_Cc1ModelType==STEPControl_FacetedBrepAndBrepWithVoids) Standard_Failure::Raise("unsupported enumeration terme");
if (m_Cc1ModelType==STEPControl_ShellBasedSurfaceModel) m_DialogType=2;
if (m_Cc1ModelType==STEPControl_GeometricCurveSet) m_DialogType=3;
//{{AFX_DATA_MAP(CFileSaveSTEPDialog)
DDX_Control(pDX, IDC_FSaveSTEP_Type, m_SaveTypeCombo);
DDX_CBIndex(pDX, IDC_FSaveSTEP_Type, m_DialogType );
//}}AFX_DATA_MAP
}
//{{AFX_DATA_MAP(CFileSaveSTEPDialog)
DDX_Control(pDX, IDC_FSaveSTEP_Type, m_SaveTypeCombo);
DDX_CBIndex(pDX, IDC_FSaveSTEP_Type, m_DialogType );
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate)
{
if (m_DialogType==0) m_Cc1ModelType=STEPControl_ManifoldSolidBrep;
if (m_DialogType==1) m_Cc1ModelType=STEPControl_FacetedBrep;
if (m_DialogType==2) m_Cc1ModelType=STEPControl_ShellBasedSurfaceModel;
if (m_DialogType==3) m_Cc1ModelType=STEPControl_GeometricCurveSet;
}
if (pDX->m_bSaveAndValidate)
{
m_Cc1ModelType = (STEPControl_StepModelType)m_DialogType;
}
}
BEGIN_MESSAGE_MAP(CFileSaveSTEPDialog, CFileDialog)
@@ -75,18 +66,19 @@ END_MESSAGE_MAP()
// CFileSaveSTEPDialog message handlers
BOOL CFileSaveSTEPDialog::OnInitDialog()
{
BOOL bRet = CFileDialog::OnInitDialog();
m_SaveTypeCombo.InsertString(-1, L"ManifoldSolidBrep");
{
BOOL bRet = CFileDialog::OnInitDialog();
m_SaveTypeCombo.InsertString(-1, L"FacetedBrep");
m_SaveTypeCombo.InsertString(-1, L"As Is");
m_SaveTypeCombo.InsertString(-1, L"Manifold Solid BRep");
m_SaveTypeCombo.InsertString(-1, L"BRep With Voids");
m_SaveTypeCombo.InsertString(-1, L"Faceted BRep");
m_SaveTypeCombo.InsertString(-1, L"Faceted BRep With Voids");
m_SaveTypeCombo.InsertString(-1, L"Shell Based Surface Model");
m_SaveTypeCombo.InsertString(-1, L"Geometric Curve Set");
m_SaveTypeCombo.SetCurSel(m_DialogType);
m_SaveTypeCombo.InsertString(-1, L"ShellBasedSurfaceModel");
m_SaveTypeCombo.InsertString(-1, L"GeometricCurveSet");
m_SaveTypeCombo.SetCurSel(m_DialogType);
return bRet;
return bRet;
}
BOOL CFileSaveSTEPDialog::OnFileNameOK()

View File

@@ -42,6 +42,17 @@ BEGIN_MESSAGE_MAP(OCC_3dBaseDoc, OCC_BaseDoc)
//}}AFX_MSG_MAP
ON_COMMAND_EX_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialRange)
ON_UPDATE_COMMAND_UI_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnUpdateObjectMaterialRange)
//RayTracing
ON_COMMAND(ID_OBJECT_RAY_TRACING,OnObjectRayTracing)
ON_COMMAND(ID_OBJECT_SHADOWS,OnObjectShadows)
ON_COMMAND(ID_OBJECT_REFLECTIONS,OnObjectReflections)
ON_COMMAND(ID_OBJECT_ANTI_ALIASING,OnObjectAntiAliasing)
ON_UPDATE_COMMAND_UI(ID_OBJECT_RAY_TRACING, OnUpdateV3dButtons)
ON_UPDATE_COMMAND_UI(ID_OBJECT_SHADOWS, OnUpdateV3dButtons)
ON_UPDATE_COMMAND_UI(ID_OBJECT_REFLECTIONS, OnUpdateV3dButtons)
ON_UPDATE_COMMAND_UI(ID_OBJECT_ANTI_ALIASING, OnUpdateV3dButtons)
END_MESSAGE_MAP()
@@ -60,6 +71,11 @@ OCC_3dBaseDoc::OCC_3dBaseDoc()
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myAISContext = new AIS_InteractiveContext (myViewer);
myRayTracingIsOn = false;
myRaytracedShadowsIsOn = true;
myRaytracedReflectionsIsOn = false;
myRaytracedAntialiasingIsOn = false;
}
OCC_3dBaseDoc::~OCC_3dBaseDoc()
@@ -424,3 +440,65 @@ void OCC_3dBaseDoc::SetMaterial(Graphic3d_NameOfMaterial Material)
myAISContext->SetMaterial (myAISContext->Current(),
(Graphic3d_NameOfMaterial)(Material));
}
// RayTracing
void OCC_3dBaseDoc::OnObjectRayTracing()
{
myRayTracingIsOn = !myRayTracingIsOn;
if(!myRayTracingIsOn)
{
myRaytracedShadowsIsOn = false;
myRaytracedReflectionsIsOn = false;
myRaytracedAntialiasingIsOn = false;
}
OnObjectRayTracingAction();
}
// Shadows
void OCC_3dBaseDoc::OnObjectShadows()
{
myRaytracedShadowsIsOn = !myRaytracedShadowsIsOn;
OnObjectRayTracingAction();
}
// Reflections
void OCC_3dBaseDoc::OnObjectReflections()
{
myRaytracedReflectionsIsOn = !myRaytracedReflectionsIsOn;
OnObjectRayTracingAction();
}
// Anti-aliasing
void OCC_3dBaseDoc::OnObjectAntiAliasing()
{
myRaytracedAntialiasingIsOn = !myRaytracedAntialiasingIsOn;
OnObjectRayTracingAction();
}
void OCC_3dBaseDoc::OnUpdateV3dButtons (CCmdUI* pCmdUI)
{
if (pCmdUI->m_nID == ID_OBJECT_RAY_TRACING)
{
pCmdUI->SetCheck(myRayTracingIsOn);
} else {
pCmdUI->Enable(myRayTracingIsOn);
if (pCmdUI->m_nID == ID_OBJECT_SHADOWS)
pCmdUI->SetCheck(myRaytracedShadowsIsOn);
if (pCmdUI->m_nID == ID_OBJECT_REFLECTIONS)
pCmdUI->SetCheck(myRaytracedReflectionsIsOn);
if (pCmdUI->m_nID == ID_OBJECT_ANTI_ALIASING)
pCmdUI->SetCheck(myRaytracedAntialiasingIsOn);
}
}
// Common function to change raytracing params and redraw view
void OCC_3dBaseDoc::OnObjectRayTracingAction()
{
myAISContext->CurrentViewer()->InitActiveViews();
Handle(V3d_View) aView = myAISContext->CurrentViewer()->ActiveView();
Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
if (myRayTracingIsOn)
aParams.Method = Graphic3d_RM_RAYTRACING;
else
aParams.Method = Graphic3d_RM_RASTERIZATION;
aParams.IsShadowEnabled = myRaytracedShadowsIsOn;
aParams.IsReflectionEnabled = myRaytracedReflectionsIsOn;
aParams.IsAntialiasingEnabled = myRaytracedAntialiasingIsOn;
myAISContext->UpdateCurrentViewer();
}

View File

@@ -57,6 +57,8 @@ public:
int OnFileImportBrep_WithInitDir (const wchar_t* InitialDir);
void OnObjectRayTracingAction();
// Generated message map functions
protected:
//{{AFX_MSG(OCC_3dBaseDoc)
@@ -81,11 +83,20 @@ protected:
afx_msg void OnObjectRemove();
afx_msg void OnUpdateObjectRemove(CCmdUI* pCmdUI);
afx_msg void OnUpdateV3dButtons(CCmdUI* pCmdUI);
afx_msg void OnObjectRayTracing();
afx_msg void OnObjectShadows();
afx_msg void OnObjectReflections();
afx_msg void OnObjectAntiAliasing();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
protected:
bool myRayTracingIsOn;
bool myRaytracedShadowsIsOn;
bool myRaytracedReflectionsIsOn;
bool myRaytracedAntialiasingIsOn;
int myPopupMenuNumber;
};

View File

@@ -47,5 +47,17 @@ int OCC_3dChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
// Create toolbar for RayTracing functionality
if (!m_RTToolBar.Create(this) || !m_RTToolBar.LoadToolBar(IDR_RAY_TRACING))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_RTToolBar.SetBarStyle(m_RTToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_RTToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_RTToolBar);
return 0;
}

View File

@@ -31,6 +31,9 @@ public:
DECLARE_MESSAGE_MAP()
//Attributes
protected:
CToolBar m_RTToolBar;
};
#endif // !defined(AFX_OCC_3DCHILDFRAME_H__84879CFC_7EE3_11D7_8632_0060B0EE281E__INCLUDED_)

View File

@@ -25,6 +25,7 @@
#define IDR_TB_AIS 149
#define IDD_GrilleRectangulaire 150
#define IDD_GrilleCirculaire 151
#define IDR_RAY_TRACING 182
#define IDD_COLORMESH 552
#define IDB_coloredmesh 554
#define IDC_RICHEDIT_ResultDialog 1001
@@ -126,6 +127,10 @@
#define ID_BUTTON2DGridRectPoints 32779
#define ID_BUTTON2DGridCircLines 32780
#define ID_OBJECT_REMOVE 32796
#define ID_OBJECT_RAY_TRACING 32898
#define ID_OBJECT_SHADOWS 32899
#define ID_OBJECT_REFLECTIONS 32900
#define ID_OBJECT_ANTI_ALIASING 32902
#define ID_BUTTONZoomAll 40000
#define ID_OBJECT_ERASE 40001
#define ID_BUTTONZoomWin 40002

View File

@@ -67,6 +67,7 @@ IDR_2dCHILDFRAME BITMAP "2dChildFrameTB.bmp"
IDR_3dCHILDFRAME BITMAP "3dChildFrameTB.bmp"
IDR_TB_AIS BITMAP "AIS_TB.bmp"
IDB_coloredmesh BITMAP "coloredm.bmp"
IDR_RAY_TRACING BITMAP "ToolbarRayTracing.bmp"
/////////////////////////////////////////////////////////////////////////////
//
@@ -280,6 +281,7 @@ 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"
@@ -386,6 +388,14 @@ BEGIN
BUTTON ID_OBJECT_DIM
END
IDR_RAY_TRACING TOOLBAR 20, 20
BEGIN
BUTTON ID_OBJECT_RAY_TRACING
BUTTON ID_OBJECT_SHADOWS
BUTTON ID_OBJECT_REFLECTIONS
BUTTON ID_OBJECT_ANTI_ALIASING
END
/////////////////////////////////////////////////////////////////////////////
//

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

View File

@@ -1,60 +1,49 @@
MFC samples {#samples_mfc_standard}
==========
1. Description of the tree structure:
---------------------------------------------
1. Contents
-----------------------
The directory <i> samples/mfc/standard </i> contains the following packages and files:
* Numbered packages: **01_Geometry**, **02_Modeling**, etc. provide projects and sources of samples;
* Files **All-vc(number).sln** are auxiliary utility projects depending on all other sample
projects. When such project is rebuilt, all samples and *mfcsample* library are also rebuilt.
* **Common** directory provides common source and header files for samples and dynamic-link library *mfcsample.dll.*
* **Data** directory stores data files.
* **mfcsample** directory contains project for *mfcsample.dll* library providing basic functionality used by all OCC samples.
* File **env.bat** is called from *msvc.bat.*
|
|-- 01_Geometry
|-- 02_Modeling
|-- 03_Viewer2d
|-- 04_Viewer3d Projects and sources of samples
|-- 05_ImportExport
|-- 06_Ocaf
|-- 07_Triangulation
|-- 08_HLR
|-- 09_Animation
|-- 10_Convert
|
|-- All-vc"number".sln Auxilary utility project. It depends on all other sample
| projects, so when rebuilded it rebuilds all samples and
| mfcsample library.
|
|-- Common Common source and header files for samples and
| dynamic-link library mfcsample.dll.
|
|-- Data Data files.
|
|-- mfcsample Project for mfcsample.dll. This library is used by all
| samples. It contains basic funcionality that commonly
| needed in every OCC sample.
|
|
|-- env.bat This file is called from msvc.bat.
2. Launching Open CASCADE Technology samples:
---------------------------------
To run the Open CASCADE Technology samples:
execute run.bat [vc8|vc9|vc10|vc11|vc12] [win32|win64] [Release|Debug] [SampleName]
To run the Open CASCADE Technology samples, use command:
To run the Animation sample:
~~~~
execute run.bat [vc8|vc9|vc10|vc11|vc12] [win32|win64] [Release|Debug] [SampleName]
~~~~
To run the **Animation** sample, use command:
~~~~
execute run.bat vc8 win32 Debug Animation
~~~~
execute run.bat vc8 win32 Debug Animation
3. Modifying and rebuilding samples:
--------------------------------------------
You can modify, compile and launch all sample projects in MS Visual C++ at once:
execute msvc.bat [vc8|vc9|vc10|vc11|vc12] [win32|win64] [Release|Debug]
You can modify, compile and launch all sample projects in MS Visual C++ at once with command:
To run all sample projects in MS Visual C++ at once:
execute msvc.bat vc8 win32 Debug
~~~~
execute msvc.bat [vc8|vc9|vc10|vc11|vc12] [win32|win64] [Release|Debug]
~~~~
To run all sample projects in MS Visual C++ at once, use command:
Note: make sure your PATH environment variable contains a directory,
msdev.exe is located in.
~~~~
execute msvc.bat vc8 win32 Debug
~~~~
Note: make sure that your *PATH* environment variable contains a directory, where *msdev.exe* is located.

View File

@@ -781,6 +781,7 @@
<None Include="..\..\..\..\Common\res\coloredm.bmp" />
<None Include="..\..\..\..\Common\res\MainFrame.ico" />
<None Include="..\..\..\..\Common\res\occ_logo.bmp" />
<None Include="..\..\..\..\Common\res\ToolbarRayTracing.bmp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -285,5 +285,8 @@
<None Include="..\..\..\..\Common\res\occ_logo.bmp">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\..\Common\res\ToolbarRayTracing.bmp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@@ -785,6 +785,7 @@
<None Include="..\..\..\..\Common\res\coloredm.bmp" />
<None Include="..\..\..\..\Common\res\MainFrame.ico" />
<None Include="..\..\..\..\Common\res\occ_logo.bmp" />
<None Include="..\..\..\..\Common\res\ToolbarRayTracing.bmp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -285,5 +285,8 @@
<None Include="..\..\..\..\Common\res\occ_logo.bmp">
<Filter>Resource Files</Filter>
</None>
<None Include="..\..\..\..\Common\res\ToolbarRayTracing.bmp">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@@ -785,6 +785,7 @@
<None Include="..\..\..\..\Common\res\coloredm.bmp" />
<None Include="..\..\..\..\Common\res\MainFrame.ico" />
<None Include="..\..\..\..\Common\res\occ_logo.bmp" />
<None Include="..\..\..\..\Common\res\ToolbarRayTracing.bmp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

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