1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

126 Commits

Author SHA1 Message Date
aba
fd45dddd93 Error Corrections 2013-08-19 17:48:51 +04:00
aba
aba5fc1923 LibCtl_Library template class was corrected. Small style changes. 2013-08-19 17:48:50 +04:00
aba
3cc51580cb 0023997: Getting rid of generic classes in DataExchange 2013-08-19 17:48:48 +04:00
vro
80cd454f1d 0023864: An & symbol is read incorrectly from a XML Ocaf file
A line is uncommented. This line sets the successfully read & symbol.
Correction and adding test cases for issue CR23864
2013-08-15 17:24:06 +04:00
emv
d3c5411b48 0024105: ShapeFix algorithm produces not correct result.
Small correction.
Adding test cases for issue CR24105
2013-08-15 17:24:03 +04:00
kgv
cc9d78dbca 0024112: Unused variables are initialized in Extrema package 2013-08-15 17:23:59 +04:00
Roman Lygin
d2d893b809 0024045: Invalid test case for matrix-vector multiplication 2013-08-15 17:23:56 +04:00
Roman Lygin
b28e7cc6d1 0024044: Performance improvements: Foundation Classes (math) 2013-08-15 17:23:53 +04:00
Roman Lygin
6f94f1dff9 0024081: Memory corruption when projecting point on surface of revolution
Adding test cases for issue CR24081
2013-08-15 17:23:50 +04:00
pkv
f4ea2ca675 0024106: Project non-regression test: geom/boolean_operations6/G3 provides incorrect result. 2013-08-15 17:23:46 +04:00
szy
7dcac1dfa0 0023766: Shape orientation processing mechanism redesign
Added missed file.
Added missed MDF_Tool.cxx.
Adding test cases for issue CR23766
2013-08-15 17:23:43 +04:00
ika
602952413f 0022535: Cut sphere: invalid shape after reading from STEP
In cutting sphere it's seam edge was divided into two parts(by cylinder),
but pcurves of  the second were not shifted during shape healing.
Test cases correction
2013-08-15 17:23:40 +04:00
pkv
1da6ad3265 0024089: Missing section edge
Added test case bugs/modalg_5/bug24089
Small correction of test case buc60462_2
2013-08-15 17:23:37 +04:00
omy
d390b16690 0024095: Eliminate compiler warning C4512 in MSVC++ with warning level 4
Removed most of warnings C4512 for non-copyable objects
2013-08-15 17:23:34 +04:00
pkv
128dba6fb7 0024092: Boolean fuse fails
Adding test cases for issue CR24092
2013-08-15 17:23:30 +04:00
omy
4e18e72a22 0024096: Eliminate compiler warning C4505 in MSVC++ with warning level 4
Removed obsolete functions from sources.
Some useful debug functions were 'defined' ( put into #ifdef ...#endif )
Removed some redundant code
2013-08-15 17:23:27 +04:00
pkv
7ff8f0197e 0024101: Self-Interference Checker provides results that are inconsistent with the Project requirements. 2013-08-15 17:23:24 +04:00
pkv
72e88cf7a8 0024098: Exception Standard_OutOfMemory raised during topological operation. 2013-08-15 17:23:20 +04:00
szy
fa13a85d92 0003513: There is no check for boundary of array in method Set for array attributes
- Added check of array's boundary in Set(i, val) methods.
- Added comments to cdl files.
- removed accidental modification in TDataStd_ExtStringArray::Value(i).
- recovering accidentally lost modifications.
2013-08-15 17:23:17 +04:00
omy
8263fcd384 0024087: Eliminate compiler warning C4244 in MSVC++ with warning level 4
Most of the compiler warnings C4244 have been eliminated.
2013-08-01 12:38:21 +04:00
ika
673693f1cf 0021317: Face cannot be fixed by Shape Healing
Fix that face, in which only wire was reordered during shape healing, was not replaced.
Add test case for this fix
Add status for shifted wires in reordering.
Modified test case de/step_1/E3 according to new reference data
2013-08-01 12:34:52 +04:00
omy
773f53f1ec 0024085: Eliminate compiler warning C4706 in MSVC++ with warning level 4
Got rid from most cases which led to Warning c4706
Tiny code style corrections
2013-08-01 12:20:35 +04:00
oan
304c45c83f 0023105: Exception during Meshing / Missing triangles
Fix compilation error on Linux
Adding test command for this fix
meshPolygon: simplify source polygon by splitting it onto parts without glued edges and loops
Check surrounded triangles during final cleaning of mesh
Correct polygon on frontier edges
Modified test cases in group mesh according to new behavior
2013-07-25 13:11:00 +04:00
apn
55f1e74d75 0023614: BRepMesh creates incorrect triangulation on the attached models
Added test cases bugs/mesh/bug23614_1 bug23614_2 bug23614_3 bug23614_4
2013-07-25 12:57:39 +04:00
ika
fdabc2117e 0023746: IGES wheel model fails to load when OCCT unit is meters
Add check for too small distances during edges reordering
Fix writing TrimmedSurface (Type 144).
Fix checking for too small distances between loops of edges during edge's reordering.
Add checking for too small BSpline segments during reading and writing IGES.
Fix wire splitting by adding checking that vertexes same not only in 3d, but in 2d too.
use tolerance of vertexes recomputed through resolution surface, not 2d curves.
Adding test case for this fix
Modified test case bugs iges bug23746 and cases in group de according to new reference data
2013-07-25 12:39:12 +04:00
apn
a9e4846fe4 0024022: Slow meshing in BRepMesh
Added test case bugs/mesh/bug24022
2013-07-25 12:35:33 +04:00
bugmaster
63fb818eb7 Update of environment files of qt samples for compilation in batch mode. 2013-07-24 15:41:33 +04:00
nbv
440906ef6a 0024077: Build errors on master branch on Mac OS X
small correction
Init() method is called with other parameter.
2013-07-22 12:31:41 +04:00
bugmaster
66deda1eea Corrected integration to remove incorrect merge fix for issue 0024057 with fix for 0023582 2013-07-19 12:43:03 +04:00
gka
da0e82aac3 0024047: Exception in TPrsStd_AISPresentation during destruction of TDocStd_Document
Adding test case for this fix
Modification in order to avoid exception during destruction of AIS_InteractiveContext
Small modification for trihedron
Small modifications to avoid regressions
Cosmetic modification
2013-07-18 13:16:35 +04:00
Roman Lygin
efef9da8e5 0024072: VC 2009 64-bit compiler crashes while compiling IntPoly_ShapeSection.cxx 2013-07-18 13:12:49 +04:00
omy
35e08fe886 0024057: Eliminate compiler warning C4100 in MSVC++ with warning level 4
Got rid of warning C4100: 'identifier' : unreferenced formal parameter
Got rid of compile errors
2013-07-18 13:09:32 +04:00
mkv
92a4955951 0024075: Boolean Section between two faces fails 2013-07-18 13:06:06 +04:00
omy
cf6625bdc6 0024076: New warning during compilation OCCT on WNT platform (release and debug)
Added return statement to disable warning
2013-07-18 12:57:50 +04:00
jgv
ee9451aba5 0023839: Projection algorithm produces wrong results for set of data
Added test cases bugs/modalg_5/bug23839_1 bug23839_2 bug23839_3 bug23839_4 bug23839_5 bug23839_6 bug23839_7
2013-07-18 12:54:38 +04:00
jgv
fa748d099f 0023582: Argument of LocOpe_WiresOnShape::SetCheckInterior() function is ignored. 2013-07-18 12:49:03 +04:00
emv
95978b2851 0024069: Confusion in the name of variables 2013-07-18 12:46:41 +04:00
ika
381a6d0e99 0023570: Command param in DRAW outputs non-readable symbols
Added test case bugs/xde/bug23570
2013-07-18 12:44:08 +04:00
bugmaster
a44902efd1 Update of environment files for compilation in batch mode. 2013-07-18 12:11:50 +04:00
ibs
03c69aec69 0024054: Move the dynamic part of main CMakeLists.txt to adm/cmake folder 2013-07-17 15:04:32 +04:00
omy
d3f26155b5 0024058: Eliminate compiler warning C4702 in MSVC++ with warning level 4
Got rid of most of warnings of C4702 type: unreachable code.
Returned some #ifdef DEB
Fixed tabs formatting
Fixed some mistakes in code
2013-07-12 12:54:01 +04:00
emv
c1746a0ac9 0024060: Wrong result done by general fuse algorithm.
Added treatment of the vertex as a single object.
Added test case bugs/modalg_5/bug24060
Modified shape's extension in test cases bugs/moddata_3/bug23943_3 bug23943_4
Modified test cases in group de according to new reference data in issue 24035
2013-07-12 12:42:42 +04:00
vro
9733d9b31b 0024062: A mistake in Geom_OffsetCurve.cdl about direction of offset
A misprint in document is corrected.
2013-07-12 12:41:15 +04:00
jgv
f7e3c52fcc 0024032: An exception raised during projection of the curve on the surface
Added test case bugs/moddata_3/bug24032
2013-07-12 12:39:06 +04:00
omy
302f96fb0d 0023947: Eliminate trivial compiler warnings in MSVC++ with warning level 4
Fix first subset of warnings (about 100)
- while(1) and similar constructs replaced by for(;;)
- some uninitialized variables corrected
Got rid of Warning C4189: local variable is initialised but not referenced
Corrected mistakes after getting rid of C4189 compiler warning
Corrected some mistakes that led to compiling errors
Fixed test case because of improvement message - removed unnecessary TODO.
Small fix: tabs have been replaced with whitespaces.
Added TODO for Windows platform
removed last TODO
Corrected mistakes, returned some #ifdef DEB code, fixed test case .
Restoring a few places which have been modified too much
Small grammar fix
Deleted unnecessary puts in bugs/end
2013-07-12 12:37:38 +04:00
ibs
a8195d65ba 0024048: "Basic Runtime Checks" option of VS projects should be equal to "RTC1"
tolreached initialized (src\ChFi3d\ChFi3d_Builder_6.cxx);
LocalTransition initialized in deb case (src\HatchGen\HatchGen_Hatcher.gxx);
vprev initialized (src\Blend\Blend_Walking_3.gxx);
uprev initialized (src\BRepBlend\BRepBlend_SurfRstLineBuilder.cxx);
lxp initialized (src\Interface\Interface_FloatWriter.cxx)
pBuff initialized (src\OSD\OSD_Process.cxx)
aPrefix initialized (src\RWStepBasic\RWStepBasic_RWSiUnitAndPlaneAngleUnit.cxx)
ier initialized AdvApp2Var/AdvApp2Var_ApproxF2var.cxx
FacRevolInfini initialized BRepFeat_MakePrism.cxx
default action of "switch" returned
nombre mas of chars was expanded to 1024 (had been 20). this expansion helps avoiding the error of conversion a float number to mas of chars: the size of mas is enough for converting float number now.
Changed status (todo ?) of tests: de step_5 A6 B3, de iges_3 A9
2013-07-12 12:29:30 +04:00
Roman Lygin
96a85238fb 0024043: Performance improvements: Modeling Algorithms
Performance improvements: Modeling Algorithms (added Shape Healing)
Added TODO to unstable test cases
2013-07-12 12:27:30 +04:00
omy
64531d9c98 0023042: Potential mistakes in (s)printf usage
Use PRIuPTR macros for Standard_Size values in printf.
Use STL streams instead of printf when reasonable.
2013-07-12 12:25:44 +04:00
jgv
bda8360543 0023625: New functionality building reflect lines on a shape
Adding test case for this fix; Small corrections
2013-07-12 12:24:21 +04:00
emv
97acf541ac 0023782: Intersection algorithm produces wrong section curves for the attached faces
The fix is to keep the correlation between numbers of segments in U and V parametric directions (nbu and nbv).
When minimal of these numbers (f.e. nbu) is set to default minimal value (10), other (nbv) is set to Min(30, nbv*(default/nbu)). 30 is used to avoid too small segments.
Added test case bugs/modalg_5/bug23782
2013-07-12 12:23:01 +04:00
emv
c1fe53c64e 0024029: Add a flag to bopcheck command to provide possibility to disable Face/Face intersection
Added new parameter to bopcheck command that defines which interferences to check:
bopcheck shape [level of check: 0 - 5]
Examples:
1. bopcheck shape 1
    #The level of check is set to V/E, i.e. intersections #E/E, V/F, E/F, F/F will not be checked.
2. bopcheck shape 4
    #The level of check is set to E/F, i.e. intersection F/F is disabled.
3. bopcheck shape 5
    #All intersections will be checked. It is the same as bopcheck shape.
Added test case bugs/modalg_5/bug24029
2013-07-12 12:21:38 +04:00
Roman Lygin
388fc344c9 0024007: [Regression] Sporadic crashes when working with XDE documents 2013-07-04 14:33:30 +04:00
Roman Lygin
1145e2bc72 0024042: Performance improvements: Foundation Classes
Removed code under former __OPTIM_ARRAY macro
2013-07-04 14:31:57 +04:00
Pawel
4bee43a928 0024019: Voxel_FastConverter: filling problem
Added a new method filling the inner part of a shape with voxels. The advantages of using this method are:
- processing vertical faces
- correct processing of 'concave' shapes
Added QA command OCC24019 for issue 24019 and test case bugs/vis/bug24019
2013-07-04 14:29:08 +04:00
emv
9c9a29ea5c 0024053: Section between plane and sphere is not correct
Small correction in splitting into intervals.
Adding test case for this fix
2013-07-04 14:26:05 +04:00
emv
093bfc493b 0024033: All the orientation as a result of BRepAlgoAPI_Common is set to INTERNAL
Dimension of the shapes is used in the condition of choosing the shape to take parts of it in the common.
Adding test case for this fix
2013-07-04 14:23:22 +04:00
emv
b20eeb13fe 0024037: Wrong result done by General Fuse algorithm
Do not calculate the angle between same edges in WireSplitter algorithm and set it to 2*PI.
Adding test cases for this fix
Correction of test case
2013-07-04 14:21:44 +04:00
emv
e656bcbe59 0024040: The result of CUT operation is not correct
Changed the way of getting point inside face for detecting same domain faces.
Adding test case for this fix
2013-07-04 14:19:17 +04:00
jgv
afed7fd721 0023994: GeomAPI_ExtremaCurveCurve class calculates wrong values
Adding test casefor this fix
2013-07-04 14:15:42 +04:00
Pawel
03679c4858 0024050: Voxel_FastConverter::Convert / ConvertUsingSAT - problems in multithreaded scenario
Computing triangle spans using integer numbers.
2013-07-04 14:12:49 +04:00
ika
404d419daa 0024035: Intersector is not symmetrical
asymmetrical check in  Standard_Boolean IntCurve_IntPolyPolyGen::findIntersect was changed to symmetrical.
fix wrong calculation of approx parameter on curve for last polygon segment
Added test case bugs/modalg_5/bug24035
Modified TODO in "de" test cases because there are small differences with old behaviour
Modified test case heal/split_closed_faces/G5 because of corrections in intersector's behavior, which lead to changes in checkshape
2013-06-27 13:56:52 +04:00
nbv
9d109e39c2 0024028: It is impossible to create a face based on Geom_RectangularTrimmedSurface by standard methods
1. Trimmed Surfaces were replaced with bases for *.igs and *.stp file format.
BRepLib_MakeFace method sets the TRIMMED surface of Geom_RectangularTrimmedSurface in created face.

2. Adding test case for this fix
2013-06-27 10:10:16 +04:00
abv
166d6cd76a 0023957: Provide CMakeLists.txt file in root folder of OCCT
Added simple CMakeLists.txt file in the root folder, redirecting to adm/cmake
2013-06-26 11:56:39 +04:00
apn
3f4689a163 Adding test cases
for following issues:

0023823: The result of section operation contains redundant vertex
0023826: Boolean Common between two solids fails
0023884: Boolean Fuse between two faces fails
0023892: Missing intersection curve between two surfaces
0023976: Extremely high memory consumption on boolean operation on 64 bits
0023991: Missing section edge between two faces
0024003: Exception reaised during intersection between two faces
2013-06-20 17:03:56 +04:00
emv
5549deff05 0024025: The method Modified2() in BRepAlgoAPI_BooleanOperation should be removed.
Removed method BRepAlgoAPI_BooleanOperation::Modified2(const TopoDS_Shape& aS) as it is no longer relevant (in the previous version of BOP it had used History collector to find modified shapes, but there is no such collector in current version of BOP). The replacement for this method is BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_Shape& aS).
Small correction of test case
2013-06-20 15:48:11 +04:00
jgv
d42d186778 0023998: Bad result of intersection of two faces: curve has a loop
Add test case for this fix
2013-06-20 15:46:20 +04:00
mkv
c8c37c2879 0022834: Instable case testing 3d offset algorithm (problem with cone-like surfaces)
Small correction of test case
2013-06-20 15:43:42 +04:00
san
3f65725b8b 0024031: Depth buffer writes not enabled after rendering a transparent object
Depth buffer writes manipulation made independent from the reflection mode flags
to ensure correct depth buffer operation after rendering transparent object(s).
Coding style improved slightly by using more human-readable variable name for
the reflection mode.
2013-06-20 15:36:15 +04:00
aba
d7223c763e 0023959: Getting rid of generic classes in Visualization: generic classes were removed from Prs3d
Errors corrections; DsgPrs_DatumTool class was removed as unused
2013-06-20 15:28:40 +04:00
emv
8ba3c5e073 0024030: Undefined reference to `NCollection_IncAllocator::DefaultBlockSize'. 2013-06-18 15:45:55 +04:00
bugmaster
6e88a46c01 Renaming shape extension of test case 2013-06-14 15:05:17 +04:00
vro
8405834525 0023939: Incorrect circle parameter in IntAna
Adding testing case
2013-06-14 12:14:35 +04:00
vro
799e449136 0023889: Assignment of function parameter has no effect outside the function.
Voxel_ROctBoolDS::SetZeroSplitData() is modified to accept an address of a pointer to deleting data.
Removal of a compilation error on Linux.
Compile error on Linux platform was fixed
2013-06-13 15:38:17 +04:00
pdn
3f16d97046 0023939: Incorrect circle parameter in IntAna
Fix for circle circle intersection in case of one point touching
Test command added
2013-06-13 15:28:55 +04:00
Pawel
f03671a0c4 0023894: Voxel_BooleanOperation (Cut) gives incorrect results
Implemented a new method using separating axis theorem to compute triangle-box intersection. Based on the intersection result the decision whether to set the voxel is made.
Adjustment of lines (removal of extra-spaces).
Adding test cases for voxel testing
2013-06-13 15:19:29 +04:00
jgv
3830895866 0023995: GeomAPI_ExtremaCurveSurface : wrong result between a curve and a plane
Adding test case for this fix
2013-06-13 15:14:37 +04:00
nbv
32ca7a5106 0023706: Cannot project point on curve
1.   Approximation of derivative (by Taylor-series and by three points).
2.   Some methods (Degree(), GetType(), D0(), D3(), DN()) are added.
3.   Getting of subInterval's boundaries.
4.   Algorithm for checking if 1st derivative is equal to zero is amended.
5.   Cases are controlled when extrema or Project point do not exist.
6.   GetNormal() function for gp_Vec2d was added.
7.   Computing of Value, D0, D1, D2 and D3 for offset curves was changed.
8.   Limitation of tolerance for derivative computing was added.
9.   Methods for computing trihedron in singularity point are added.
10. Test tests/bugs/moddata_3/bug23706 is added.
11. Restriction on the LastParameter for visualization of 3-D curves. Calling PlotCurve(...) function for last interval.
12. LProp package is modified for tangent computing in singularity point (LProp_CLProps, LProp_SLProps).
13. Added test cases for issue.
Deleting bad test cases for this fix
2013-06-13 15:12:06 +04:00
emv
71797c62f1 0024016: Test case bugs moddata_2 bug324 works not correct after integration of the fix for the issue 0023985.
Do not perform the check for the height of the cylinder (see issue 0023985) for infinite cylinders.
2013-06-13 15:06:46 +04:00
aba
18d715bde0 0023670: Support for multiple 3D views: edited commands: vinit; added commands: vclose, vactivate, vviewlist
bugs/end script was edited to dump results from all opened views; duplicated vinit was deleted from bug625. QABugs::OCC280()
was edited to work with multiviews;ViewerInit() method was corrected. vviewlist command was modificated to output string.
Small corrections
Compile errors were corrected
2013-06-13 14:57:07 +04:00
Pawel
da8536ad43 0024018: Voxel_FastConverter::Convert - avoiding unnecessary iterations when using multiple threads
After processing 'end_thread_triangle' the method exits instead of just continuing the iteration.
Formatting adjusted.
2013-06-13 14:49:26 +04:00
Pawel
c5e9fb8bad 0024013: Voxel_FastConverter is able to use existing triangulation
Added the possibility to use existing triangulation within Voxel_FastConverter.
A grammar mistake is corrected.
2013-06-13 14:45:04 +04:00
apn
85c44a05a0 0023952: Improving thread-safety of intersections, approximations and other modeling algorithms
Modified QAcommands OCC23952sweep and OCC23952intersect to prevent exception in appropriate test cases
2013-06-06 11:06:26 +04:00
emv
fee4fa0f01 0024004: Initialization of arrays TPoints, TEdges, TTriangles of the class IntPolyh_MaillageAffinage by exact values
This commit implements two ideas for current version of OCCT:
1. Initialization of the arrays of the class IntPolyh_MaillageAffinage by exact values. The idea suggested by Roman Lygin (http://opencascade.blogspot.fr/2008/12/why-are-boolean-operations-so-sloooooow.html [^]);
2. Optimizing for loops. The idea has been taken from OCE (7b19650b29 [^]).
2013-06-06 10:31:03 +04:00
szv
bd0c22ce9f 0023988: Force use of reentrant mode
Reentrant mode switch is eliminated
2013-06-06 10:27:42 +04:00
Pawel
310659466b 0024010: Voxel_DS: getting the origin point of a voxel
A method obtaining the voxel origin added.
1. (xc, yc, zc) is renamed to (x0, y0, z0)
2. The method GetCenter() calls now the method GetOrigin() internally to reduce amount of code and increase readability.
2013-06-06 10:21:21 +04:00
Pawel
bbf847ad1b 0023501: Redundant triangulation cleaning/generation (1) in AIS_Shape.cxx
Cleaning triangulation only if the AIS_Shape has either (1) OwnDeviationAngle and
the values 'newangle' and 'prevangle' are different or (2) OwnDeviationCoefficient and the values 'newcoeff' and 'prevcoeff' are different
Found similar problems in further code portions and corrected them.
The same faulty condition found in XCAFPrs_AISObject.cxx
2013-06-06 10:13:30 +04:00
apn
c6df241cea Adjusting testing cases for current state of OCCT 2013-06-03 14:45:39 +04:00
bugmaster
a9926dd8dd Update source code 2013-05-31 20:04:11 +04:00
vro
f8fc2b2a2d 0023935: Compiler warnings on returning Handle from C functions in OCAF schemas
The warning 4190 is disabled because a C++ object calling from C section is manipulating only in C++ (outside of C section).
Second attempt to remove the warning: extern "C" is removed - everything works fine. But I tested it only on Windows.
Removed "Create##schema" method at all: without "extern "C"" it is useless. Checked that in OCCT and Samples this method is unused.

"new ##Schema" is used instead (like in StdDrivers.cxx, for an example). Also this approach is advised in Storage_Schema.cdl:
    	--   For example, if ShapeSchema is the class
    	-- inheriting from Storage_Schema and containing
    	-- the description of your application data schema,
    	-- you create a storage/retrieval algorithm as follows:
    	-- Handle(ShapeSchema) s = new
    	-- ShapeSchema;
2013-05-31 17:29:27 +04:00
emv
04cbc9d384 0023985: There is no section between attached faces.
Added new parameter for checking whether the plane and cylinder are parallel - the height of the cylinder.
This parameter is needed for the cases when angle between AXIS and plane's normal is very close to PI,
but the "height" is big enough that point, translated from intersection point between cylinder's axis and plane
on the "height" distance in the direction of cylinder's axis, does not belong to the plane.
Such plane and cylinder cannot be considered as parallel.
Add test case for this fix
2013-05-31 17:17:34 +04:00
ifv
470ebb43f2 0023945: GeomAdaptor_Surface fails to compute the first derivatives on the surface of the attached face
Add test case for this fix
Add new draw-command OCC23945 for testing this fix
Add new draw-command for testing tis fix
2013-05-31 17:13:38 +04:00
ifv
a0f8845f56 0023982: Wire explorer raises exception
Add test case for this fix
2013-05-31 17:10:17 +04:00
abv
80482e0178 0023970: Ignore dot-paths when searching for data files 2013-05-31 17:08:23 +04:00
Roman Lygin
1ef32e96ee 0023952: Improving thread-safety of intersections, approximations and other modeling algorithms
AdvApp2Var_SysBase::mcrgene_ size reduced from 1000 to 32 elements, and each element reworked into typed structure.
fixed IntAna_Curve.cxx to prevent access to #NAN# SigneSqrtDis
fixed alignment of doubles by 8 bytes, and minor corrections
Minor correction: static const N given more specific name (MAX_ALLOC_NB)
Added QAcommands OCC23952sweep and OCC23952intersect
Added test cases bugs/modalg_5/bug23952_1 bug23952_2
2013-05-31 17:04:58 +04:00
Roman Lygin
416d012709 0023944: Typo in ShapeCustom_RestrictionParameters leading to wrong approximation results
Add test case for this fix
2013-05-31 16:58:07 +04:00
Pawel
20b1ae2c3c 0023996: Width 50 given in format string (no. 2) is larger than destination buffer 'vale[50]'
Increased the size of the destination buffer to avoid possible overflow.
2013-05-31 16:54:49 +04:00
Pawel
034b4775dc 0023965: Making unnecessary copies of TopoDS_Face in Voxel_FastConverter when checking triangulation
Using reference of TopoDS_Face instead of a copy.
Checking if the obtained triangulation is not Null before continuing.
2013-05-31 16:52:31 +04:00
Pawel
eb57b012e8 0023966: Voxel_FastConverter performs unnecessary triangulation.
Avoiding creating new triangulation in case a triangulation with a deflection value not greater than the one specified exists.
2013-05-31 16:50:36 +04:00
abv
8fd76287f8 0022831: Regression in boolean Cut - wrong result ( 6.5.2).
Adding testing case
2013-05-23 14:57:11 +04:00
abv
f404c5c215 0023946: Uninitialized variable aNewEdge3 used
Code for creation of extra edges in BRepMesh (special case) corrected
2013-05-23 14:55:05 +04:00
Roman Lygin
c15398ab70 239343: OCC fails to work with offset surfaces with singularities
Add test cases for this fix
2013-05-23 14:52:21 +04:00
vro
f7b4312f04 0023850: TDataStd_ByteArray is too slow on storage on disk
Optimization of a byte-array for XML persistence (binary persistence is ok).
A possible bug is corrected (size of an array is extended a little).
Same improvement for storage of a TDataStd_TreeNode.
Improvement of speed of storage of several Ocaf attributes in XML file format.
Also, format of storage of a double value is extended to keep 17 digits after a decimal point (it was used only 15 digits before).
Several draw-commands are added to manipulate the basic Ocaf attributes:
BooleanArray
BooleanList
IntegerList
RealList
A test-script for OCAF document successfully saved and opened from disk in XML file format.
+ 1 is added to keep '\0'
Removed several spaces in source files.
PLib_LocalArray is renamed to NCollection_LocalArray and became a template. It is used as a local array for Standard_Character in XML OCAF drivers, and as a local array of Standard_Real in PLib package.
Small correction of test case for this fix
2013-05-23 12:09:09 +04:00
omy
5a77460e4a 0023901: Memory leaks in tests.
1. Removed cyclic reference. Removed field myCommonBlock from BOPDS_PaveBlock;
2. Added data map myMapPBCB in BOPDS_DS. It contains pairs (PaveBlock, CommonBlock);
3. All methods about common block have been shifted from BOPDS_PaveBlock to BOPDS_DS;
4. Test case bugs moddata_2 pro19422_2 has been rewritten to build the correct result.
Test case corrected (TODO removed)
2013-05-23 12:02:14 +04:00
kgv
6a7d83c480 0023904: Multiple warning on Windows x86_64 target concerning WinAPI usage 2013-05-23 11:57:26 +04:00
emv
f14190252b 0023933: Self intersection reported after Fuse operation.
Additional check has been added in IntTools_BeanFaceIntersector::FastComputeExactIntersection() to prevent
creating an Edge/Face intersection for the case when edge lies on the surface of the face, but not on the face itself.
Adding test case for this fix
2013-05-23 11:55:08 +04:00
apn
8b7c9cb469 Adjusting testing cases for current state of OCCT 2013-05-17 12:29:32 +04:00
emv
d633fd7069 0023906: Performance of the projection algorithm in some cases became lower after integration of the fix for the bug 0022610.
New search algorithm Extrema_ExtAlgo_Tree used in projection algorithm in Boolean Operations.
Extrema is set to search only min distance.
Add test case for this fix
Draw command projponf has been modified to provide possibility to change the default parameters of Extrema_ExtPS algorithm:
projponf f pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]
-min - Extrema_ExtFlag_MIN;
-max - Extrema_ExtFlag_MAX;
-minmax - Extrema_ExtFlag_MINMAX (default);
-g - Extrema_ExtAlgo_Grad (default);
-t - Extrema_ExtAlgo_Tree;
Examples:
projponf f pnt -min  - the parameters are Extrema_ExtFlag_MIN and Extrema_ExtAlgo_Grad;
projponf f pnt -t  - the parameters are Extrema_ExtFlag_MINMAX and Extrema_ExtAlgo_Tree;
projponf f pnt -min -t  - the parameters are Extrema_ExtFlag_MIN and Extrema_ExtAlgo_Tree;
2013-05-16 17:55:09 +04:00
pdn
db56cc2d24 0023949: OCC IncAllocator allocates second and further blocks with different size then first one
NCollection_IncAllocator tuned to allocate blocks of equal size to reduce fragmentation and increase chances for block reuse
2013-05-16 17:51:57 +04:00
ika
2a141d40f0 0023938: Crash at StepToTopoDS_TranslateEdgeLoop::Init() &StepToTopoDS_TranslateEdge::Init()
necessary checks were added
2013-05-16 17:49:29 +04:00
kgv
ac4aaa9821 0023960: Particular ViewerTest commands lack self-description 2013-05-16 17:46:50 +04:00
nbv
ab87e6fc2e 0023748: Bad monitoring of intermediate results in offset commands 2013-05-16 11:46:21 +04:00
abv
ac29d56ac7 0023953: Avoid unjustified use of $CASROOT and exporting to GIF in tests
Function locate_data_file is used instead of direct path in 3rdparty fonts tests
DE tests changed to produce PNG images
2013-05-16 11:40:49 +04:00
ifv
12f139fde8 0022766: Wrong results done by several algorithms for the case of intersection between a surface of revolution and a plane
Add test case for this fix
2013-05-16 11:38:13 +04:00
skv
cf3327f417 0023903: Invalid result of pipe operation on closed path
Add test case for this fix
2013-05-16 11:35:11 +04:00
bugmaster
244587f413 0023402: Issue in BRepAlgoAPI_Common - SOLID and FACE
Added test case bugs/modalg_5/bug23402

Rebased on current state of master
2013-05-16 11:31:43 +04:00
ika
1939140c23 0023771: Writing offset-based surfaces of revolution to IGES
Parameter to write offset curves like b-splines was added
Change function, which convert offset curves to b-splines
Added test command "test_offset"
Added test cases bugs/xde/bug23771_1 bug23771_2
2013-05-16 11:14:51 +04:00
kgv
2361d7e861 0023486: Remove obsolete image manipulation classes
Remove AlienImage package. Clean up Image package.
2013-05-16 11:09:31 +04:00
vro
bbd048069d 0023912: TDataStd_ExtStringArray::Value() returns a copy of TCollection_ExtendedString, but it might return a reference.
Since now TDataStd_ExtStringArray::Value() returns a constant reference to the string value.
Also, a draw-command GetExtStringArray is modified to manipulate with the string by a constant reference.
Added test case bugs/caf/bug23912
2013-05-16 11:07:43 +04:00
kgv
ee1e83b94b 0023917: Primitive Array with reserved but unused Edges array drawn corrupted from VBO 2013-05-16 11:04:05 +04:00
Roman Lygin
fa523cddc5 0023920: Change use of static variables in Message package to prevent data races in Shape Healing 2013-05-16 11:02:04 +04:00
bugmaster
d18bedc711 Update of testing cases for current state of OCCT 2013-04-29 16:13:25 +04:00
bugmaster
ed6a9c100b Changing OCC_VERSION_DEVELOPMENT to dev 2013-04-29 12:19:45 +04:00
Roman Lygin
ed6afcbdcf 0023919: Redefine operator* to Handle_Standard_{Transient|Persistent} subclasses 2013-04-26 15:35:39 +04:00
apn
5879dab46b 0023916: Test artifacts in current directory
Improvements to prevent producing artifacts (files) in current directory
Modified QA command OCC7141 to save file in specific location
2013-04-26 15:33:30 +04:00
dbv
b4def8937f 0023915: Redundant header inclusion
Removed redundant inclusion
2013-04-26 15:31:54 +04:00
omy
d0e4e57891 0023843: scanf without field width limits can crash with huge input data.
Corrected width specifiers and use of buffer arrays in *printf and *scanf functions.
Removed unreferenced variable warning.
Got rid of compiler warning (returning address of local variable or temporary).
2013-04-26 15:29:28 +04:00
1810 changed files with 37753 additions and 45547 deletions

516
CMakeLists.txt Normal file
View File

@@ -0,0 +1,516 @@
cmake_minimum_required ( VERSION 2.6)
if (NOT BUILD_TYPE)
set(BUILD_TYPE "Release" CACHE STRING "Build type of the OCCT" FORCE)
SET_PROPERTY(CACHE BUILD_TYPE PROPERTY STRINGS Release Debug)
endif()
set(CMAKE_CONFIGURATION_TYPES ${BUILD_TYPE} CACHE INTERNAL "" FORCE)
project(OCCT)
set_property(GLOBAL PROPERTY 3RDPARTY_USE_FOLDERS ON)
set(BUILD_SHARED_LIBS ON)
IF("${BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE}" AND "${BUILD_BITNESS}" STREQUAL "${BUILD_BITNESS1}")
SET(CHANGES_ARE_NEEDED OFF)
ELSE()
SET(CHANGES_ARE_NEEDED ON)
ENDIF()
set(BUILD_BITNESS 32 CACHE STRING "Bitness of the OCCT project")
SET_PROPERTY(CACHE BUILD_BITNESS PROPERTY STRINGS 32 64)
SET(BUILD_BITNESS1 ${BUILD_BITNESS} CACHE INTERNAL "Temporary bitness is created to check whether change 3rdparty paths or not" FORCE)
SET( CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE INTERNAL "Build type of the OCCT" FORCE )
SET( INSTALL_DIR "" CACHE PATH "Directory contains install files of the OCCT" )
SET( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
set (BUILD_TOOLKITS "" CACHE STRING "Toolkits are included in OCCT")
separate_arguments(BUILD_TOOLKITS)
include(adm/cmake/CMakeModules.txt)
if (WIN32)
set(SCRIPT_EXT bat)
else()
set(SCRIPT_EXT sh)
endif()
if (DEFINED MSVC70)
SET(COMPILER vc7)
elseif (DEFINED MSVC80)
SET(COMPILER vc8)
elseif (DEFINED MSVC90)
SET(COMPILER vc9)
elseif (DEFINED MSVC10)
SET(COMPILER vc10)
elseif (DEFINED MSVC11)
SET(COMPILER vc11)
else()
SET(COMPILER ${CMAKE_GENERATOR})
endif()
if (${BUILD_BITNESS} STREQUAL 64)
add_definitions(-D_OCC64)
endif()
add_definitions(-DCSFDB)
if(WIN32)
add_definitions(/DWNT -wd4996)
elseif(APPLE)
add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H)
else()
add_definitions(-fexceptions -fPIC -DOCC_CONVERT_SIGNALS -DHAVE_WOK_CONFIG_H -DHAVE_CONFIG_H -DLIN)
endif()
string(REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
IF(ISFLAG)
STRING(REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSEIF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
ENDIF()
IF(WIN32)
IF(NOT DEFINED MSVC70 AND NOT DEFINED MSVC80)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP")
ENDIF()
ENDIF()
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEB")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEB")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out/bin)
# RESOURCES
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/DrawResources" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/StdResource" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/SHMessage" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/Textures" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSMessage" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/TObj" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XSTEPResource" DESTINATION "${INSTALL_DIR}/src" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/src/XmlOcafResource" DESTINATION "${INSTALL_DIR}/src" )
install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Lexi_Expr.dat" DESTINATION "${INSTALL_DIR}/src/UnitsAPI" )
install(FILES "${CMAKE_SOURCE_DIR}/src/UnitsAPI/Units.dat" DESTINATION "${INSTALL_DIR}/src/UnitsAPI" )
IF("${BUILD_TYPE}" STREQUAL "Release")
SET(BUILD_SUFFIX "")
ELSE()
SET(BUILD_SUFFIX "") # debug == release
ENDIF()
FUNCTION(SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
file(GLOB SUB_ITEMS "${MAIN_DIRECTORY}/*")
foreach(ITEM ${SUB_ITEMS})
if(IS_DIRECTORY "${ITEM}")
GET_FILENAME_COMPONENT(ITEM_NAME "${ITEM}" NAME)
LIST(APPEND LOCAL_RESULT "${ITEM_NAME}")
endif()
endforeach()
set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
ENDFUNCTION()
FUNCTION(FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
string( TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME )
LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*${COMPILER}.*${BUILD_BITNESS}")
LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${COMPILER}.*${BUILD_BITNESS}")
LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+.*${BUILD_BITNESS}")
LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}.*[0-9.]+")
LIST(APPEND SEARCH_TEMPLATES "${lower_PRODUCT_NAME}")
SUBDIRECTORY_NAMES( "${ROOT_DIR}" SUBDIR_NAME_LIST)
FOREACH( SEARCH_TEMPLATE ${SEARCH_TEMPLATES})
IF(LOCAL_RESULT)
BREAK()
ENDIF()
FOREACH(SUBDIR_NAME ${SUBDIR_NAME_LIST})
string( TOLOWER "${SUBDIR_NAME}" lower_SUBDIR_NAME )
STRING(REGEX MATCH "${SEARCH_TEMPLATE}" DUMMY_VAR "${lower_SUBDIR_NAME}")
IF(DUMMY_VAR)
LIST(APPEND LOCAL_RESULT ${SUBDIR_NAME})
ENDIF()
ENDFOREACH()
ENDFOREACH()
IF(LOCAL_RESULT)
LIST(LENGTH "${LOCAL_RESULT}" LOC_LEN)
MATH(EXPR LAST_ELEMENT_INDEX "${LOC_LEN}-1")
LIST(GET LOCAL_RESULT ${LAST_ELEMENT_INDEX} DUMMY)
SET(${RESULT} ${DUMMY} PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
IF(WIN32)
SET(DLL_SO "dll")
SET(DLL_SO_FOLDER "bin")
SET(DLL_SO_PREFIX "")
ELSEIF(APPLE)
SET(DLL_SO "dylib")
SET(DLL_SO_FOLDER "lib")
SET(DLL_SO_PREFIX "lib")
ELSE()
SET(DLL_SO "so")
SET(DLL_SO_FOLDER "lib")
SET(DLL_SO_PREFIX "lib")
ENDIF()
SET(3RDPARTY_DIR "" CACHE PATH "Directory contains required 3rdparty products")
SET(3RDPARTY_INCLUDE_DIRS "")
SET(3RDPARTY_NOT_INCLUDED)
IF(APPLE)
SET(3RDPARTY_USE_GLX OFF CACHE BOOL "whether use X11 OpenGL on OSX or not")
ENDIF()
SET(3RDPARTY_USE_GL2PS OFF CACHE BOOL "whether use gl2ps product or not")
SET(3RDPARTY_USE_FREEIMAGE OFF CACHE BOOL "whether use freeimage product or not")
SET(3RDPARTY_USE_TBB OFF CACHE BOOL "whether use tbb product or not")
SET(INSTALL_TESTS OFF CACHE BOOL "Is tests copy to install directory")
MACRO(THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_NAME)
IF(NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
SET(3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "Directory contains ${PRODUCT_NAME} product")
ENDIF()
IF(3RDPARTY_DIR AND ("${3RDPARTY_${PRODUCT_NAME}_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" ${PRODUCT_NAME} ${PRODUCT_NAME}_DIR_NAME)
IF("${${PRODUCT_NAME}_DIR_NAME}" STREQUAL "")
MESSAGE(STATUS "${PRODUCT_NAME} DON'T FIND")
ELSE()
SET(3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_DIR}/${${PRODUCT_NAME}_DIR_NAME}" CACHE PATH "Directory contains ${PRODUCT_NAME} product" FORCE)
ENDIF()
ENDIF()
SET(INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "Is ${PRODUCT_NAME} lib copy to install directory")
IF(3RDPARTY_${PRODUCT_NAME}_DIR)
IF("${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
SET(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "Directory contains headers of the ${PRODUCT_NAME} product" FORCE)
FIND_PATH(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME} PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/include" NO_DEFAULT_PATH)
IF("${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
FIND_PATH(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR ${HEADER_NAME})
ENDIF()
ENDIF()
IF("${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND")
SET(3RDPARTY_${PRODUCT_NAME}_LIBRARY "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "Directory contains library of the ${PRODUCT_NAME} product" FORCE)
FIND_LIBRARY(3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME} PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/lib" NO_DEFAULT_PATH)
# check default path for library search
IF("${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY-NOTFOUND")
FIND_LIBRARY(3RDPARTY_${PRODUCT_NAME}_LIBRARY ${LIBRARY_NAME})
ENDIF()
ENDIF()
IF("${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND")
SET(3RDPARTY_${PRODUCT_NAME}_DLL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND" CACHE FILEPATH "Directory contains shared library of the ${PRODUCT_NAME} product" FORCE)
FIND_FILE(3RDPARTY_${PRODUCT_NAME}_DLL "${DLL_SO_PREFIX}${LIBRARY_NAME}.${DLL_SO}" PATHS "${3RDPARTY_${PRODUCT_NAME}_DIR}/${DLL_SO_FOLDER}" NO_DEFAULT_PATH)
IF("${3RDPARTY_${PRODUCT_NAME}_DLL}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL-NOTFOUND")
FIND_FILE(3RDPARTY_${PRODUCT_NAME}_DLL "${DLL_SO_PREFIX}${LIBRARY_NAME}.${DLL_SO}")
ENDIF()
ENDIF()
MARK_AS_ADVANCED(3RDPARTY_${PRODUCT_NAME}_DIR)
ENDIF()
IF(3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
ENDIF()
IF(3RDPARTY_${PRODUCT_NAME}_LIBRARY)
GET_FILENAME_COMPONENT(3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR "${3RDPARTY_${PRODUCT_NAME}_LIBRARY}" PATH)
SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR}")
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_LIBRARY)
ENDIF()
IF(3RDPARTY_${PRODUCT_NAME}_DLL)
#
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_DLL)
ENDIF()
IF(INSTALL_${PRODUCT_NAME})
INSTALL(FILES "${3RDPARTY_${PRODUCT_NAME}_DLL}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
SET(3RDPARTY_${PRODUCT_NAME}_DLL_DIR "")
ELSE()
GET_FILENAME_COMPONENT(3RDPARTY_${PRODUCT_NAME}_DLL_DIR "${3RDPARTY_${PRODUCT_NAME}_DLL}" PATH)
ENDIF()
ENDMACRO()
# TCL
#tcl85 - win; tcl8.5 - lin
IF(WIN32)
SET(TCL_SEP "")
ELSE()
SET(TCL_SEP ".")
ENDIF()
THIRDPARTY_PRODUCT("TCL" "tcl.h" "tcl8${TCL_SEP}5")
#install tk and libs
IF(INSTALL_TCL)
GET_FILENAME_COMPONENT(3RDPARTY_TK_LIB_DIR "${3RDPARTY_TCL_LIBRARY}" PATH)
GET_FILENAME_COMPONENT(3RDPARTY_TK_DLL_DIR "${3RDPARTY_TCL_DLL}" PATH)
INSTALL(FILES "${3RDPARTY_TK_DLL_DIR}/${DLL_SO_PREFIX}tk8${TCL_SEP}5.${DLL_SO}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
INSTALL(DIRECTORY "${3RDPARTY_TK_LIB_DIR}/tcl8.5" DESTINATION "${INSTALL_DIR}/lib")
INSTALL(DIRECTORY "${3RDPARTY_TK_LIB_DIR}/tk8.5" DESTINATION "${INSTALL_DIR}/lib")
ENDIF()
# GLX
IF(3RDPARTY_USE_GLX)
ADD_DEFINITIONS(-DMACOSX_USE_GLX)
IF(NOT DEFINED 3RDPARTY_GLX_DIR)
SET(3RDPARTY_GLX_DIR "" CACHE PATH "Directory contains GLX product")
ENDIF()
IF(3RDPARTY_DIR AND ("${3RDPARTY_GLX_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" GLX GLX_DIR_NAME)
IF("${GLX_DIR_NAME}" STREQUAL "")
MESSAGE(STATUS "GLX DON'T FIND")
ELSE()
SET(3RDPARTY_GLX_DIR "${3RDPARTY_DIR}/${GLX_DIR_NAME}" CACHE PATH "Directory contains GLX product" FORCE)
ENDIF()
ENDIF()
IF(3RDPARTY_GLX_DIR)
SET(3RDPARTY_GLX_INCLUDE_DIR "${3RDPARTY_GLX_DIR}/include" CACHE FILEPATH "Directory contains headers of the GLX product" FORCE)
SET(3RDPARTY_GLX_LIBRARY_DIR "${3RDPARTY_GLX_DIR}/lib" CACHE FILEPATH "Directory contains library of the GLX product" FORCE)
SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_GLX_INCLUDE_DIR}")
SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_GLX_LIBRARY_DIR}")
MARK_AS_ADVANCED(3RDPARTY_GLX_DIR)
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_GLX_INCLUDE_DIR)
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_GLX_LIBRARY_DIR)
ENDIF()
ENDIF()
# FREETYPE
THIRDPARTY_PRODUCT("FREETYPE" "ft2build.h" "freetype${BUILD_SUFFIX}")
IF("${3RDPARTY_FREETYPE_INCLUDE_DIR}" STREQUAL "" OR "${3RDPARTY_FREETYPE_INCLUDE_DIR}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND")
ELSEIF(EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR}/freetype2/")
SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_FREETYPE_INCLUDE_DIR}/freetype2")
ENDIF()
# FREEIMAGE
IF(3RDPARTY_USE_FREEIMAGE)
ADD_DEFINITIONS(-DHAVE_FREEIMAGE)
THIRDPARTY_PRODUCT("FREEIMAGE" "FreeImage.h" "freeimage${BUILD_SUFFIX}")
IF(WIN32)
IF("${3RDPARTY_FREEIMAGE_DIR}" STREQUAL "")
ELSE()
SET (3RDPARTY_FREEIMAGEPLUS_DIR "${3RDPARTY_FREEIMAGE_DIR}")
ENDIF()
THIRDPARTY_PRODUCT("FREEIMAGEPLUS" "FreeImagePlus.h" "freeimageplus${BUILD_SUFFIX}")
ENDIF()
ENDIF()
# GL2PS
IF(3RDPARTY_USE_GL2PS)
ADD_DEFINITIONS(-DHAVE_GL2PS)
THIRDPARTY_PRODUCT("GL2PS" "gl2ps.h" "gl2ps${BUILD_SUFFIX}")
ENDIF()
# TBB
IF (3RDPARTY_USE_TBB)
ADD_DEFINITIONS(-DHAVE_TBB)
IF(${BUILD_BITNESS} STREQUAL 32)
SET (TBB_ARCH_NAME ia32)
ELSE()
SET (TBB_ARCH_NAME intel64)
ENDIF()
IF(NOT DEFINED 3RDPARTY_TBB_DIR)
SET(3RDPARTY_TBB_DIR "" CACHE PATH "Directory contains tbb product")
ENDIF()
SET(3RDPARTY_TBB_DIR_NAME "")
IF(3RDPARTY_DIR AND ("${3RDPARTY_TBB_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED))
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" "TBB" 3RDPARTY_TBB_DIR_NAME)
IF("${3RDPARTY_TBB_DIR_NAME}" STREQUAL "")
MESSAGE(STATUS "TBB DON'T FIND")
ELSE()
SET(3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${3RDPARTY_TBB_DIR_NAME}" CACHE PATH "Directory contains tbb product" FORCE)
ENDIF()
ENDIF()
SET(INSTALL_TBB OFF CACHE BOOL "Is tbb lib copy to install directory")
IF(3RDPARTY_TBB_DIR)
IF("${3RDPARTY_TBB_INCLUDE_DIR}" STREQUAL "" OR CHANGES_ARE_NEEDED)
SET(3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "Directory contains headers of the tbb product" FORCE)
FIND_PATH(3RDPARTY_TBB_INCLUDE_DIR tbb/tbb.h PATHS "${3RDPARTY_TBB_DIR}/include")
ENDIF()
SET(TBB_DEBUG_POSTFIX "")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
SET(TBB_DEBUG_POSTFIX "") # _debug postfix removed
ENDIF()
IF("${3RDPARTY_TBB_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TBB_LIBRARY}" STREQUAL "3RDPARTY_TBB_LIBRARY-NOTFOUND")
SET(3RDPARTY_TBB_LIBRARY "3RDPARTY_TBB_LIBRARY-NOTFOUND" CACHE PATH "Directory contains library of the tbb product" FORCE)
FIND_LIBRARY(3RDPARTY_TBB_LIBRARY tbb${TBB_DEBUG_POSTFIX} PATHS "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
IF("${3RDPARTY_TBB_LIBRARY}" STREQUAL "3RDPARTY_TBB_LIBRARY-NOTFOUND")
FIND_LIBRARY(3RDPARTY_TBB_LIBRARY tbb${TBB_DEBUG_POSTFIX})
ENDIF()
ENDIF()
IF("${3RDPARTY_TBB_MALLOC_LIBRARY}" STREQUAL "" OR CHANGES_ARE_NEEDED OR "${3RDPARTY_TBB_MALLOC_LIBRARY}" STREQUAL "3RDPARTY_TBB_MALLOC_LIBRARY-NOTFOUND")
SET(3RDPARTY_TBB_MALLOC_LIBRARY "3RDPARTY_TBB_MALLOC_LIBRARY-NOTFOUND" CACHE PATH "Directory contains library of the tbb malloc product" FORCE)
FIND_LIBRARY(3RDPARTY_TBB_MALLOC_LIBRARY tbbmalloc${TBB_DEBUG_POSTFIX} PATHS "${3RDPARTY_TBB_DIR}/lib/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
IF("${3RDPARTY_TBB_MALLOC_LIBRARY}" STREQUAL "3RDPARTY_TBB_MALLOC_LIBRARY-NOTFOUND")
FIND_LIBRARY(3RDPARTY_TBB_MALLOC_LIBRARY tbbmalloc${TBB_DEBUG_POSTFIX})
ENDIF()
ENDIF()
IF("${3RDPARTY_TBB_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED)
SET(3RDPARTY_TBB_DLL "3RDPARTY_TBB_DLL-NOTFOUND" CACHE PATH "Directory contains shared library of the tbb product" FORCE)
FIND_FILE(3RDPARTY_TBB_DLL "${DLL_SO_PREFIX}tbb${TBB_DEBUG_POSTFIX}.${DLL_SO}" PATHS "${3RDPARTY_TBB_DIR}/${DLL_SO_FOLDER}/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
IF("${3RDPARTY_TBB_DLL}" STREQUAL "3RDPARTY_TBB_DLL-NOTFOUND")
FIND_FILE(3RDPARTY_TBB_DLL "${DLL_SO_PREFIX}tbb${TBB_DEBUG_POSTFIX}.${DLL_SO}")
ENDIF()
ENDIF()
IF("${3RDPARTY_TBB_MALLOC_DLL}" STREQUAL "" OR CHANGES_ARE_NEEDED)
SET(3RDPARTY_TBB_MALLOC_DLL "3RDPARTY_TBB_MALLOC_DLL-NOTFOUND" CACHE PATH "Directory contains shared library of the tbb malloc product" FORCE)
FIND_FILE(3RDPARTY_TBB_MALLOC_DLL "${DLL_SO_PREFIX}tbbmalloc${TBB_DEBUG_POSTFIX}.${DLL_SO}" PATHS "${3RDPARTY_TBB_DIR}/${DLL_SO_FOLDER}/${TBB_ARCH_NAME}/${COMPILER}" NO_DEFAULT_PATH)
IF("${3RDPARTY_TBB_MALLOC_DLL}" STREQUAL "3RDPARTY_TBB_MALLOC_DLL-NOTFOUND")
FIND_FILE(3RDPARTY_TBB_MALLOC_DLL "${DLL_SO_PREFIX}tbbmalloc${TBB_DEBUG_POSTFIX}.${DLL_SO}")
ENDIF()
ENDIF()
MARK_AS_ADVANCED(3RDPARTY_TBB_DIR_NAME)
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_DIR)
ENDIF()
IF(3RDPARTY_TBB_INCLUDE_DIR)
SET(3RDPARTY_INCLUDE_DIRS "${3RDPARTY_INCLUDE_DIRS};${3RDPARTY_TBB_INCLUDE_DIR}")
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
ENDIF()
IF(3RDPARTY_TBB_LIBRARY)
GET_FILENAME_COMPONENT(3RDPARTY_TBB_LIBRARY_DIR "${3RDPARTY_TBB_LIBRARY}" PATH)
SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_TBB_LIBRARY_DIR}")
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_LIBRARY)
ENDIF()
IF(3RDPARTY_TBB_MALLOC_LIBRARY)
GET_FILENAME_COMPONENT(3RDPARTY_TBB_LIBRARY_DIR "${3RDPARTY_TBB_MALLOC_LIBRARY}" PATH)
SET(3RDPARTY_LIBRARY_DIRS "${3RDPARTY_LIBRARY_DIRS};${3RDPARTY_TBB_LIBRARY_DIR}")
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_MALLOC_LIBRARY)
ENDIF()
IF(3RDPARTY_TBB_DLL)
#
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_DLL)
ENDIF()
IF(3RDPARTY_TBB_MALLOC_DLL)
#
ELSE()
LIST(APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_MALLOC_DLL)
ENDIF()
IF(INSTALL_TBB)
INSTALL(FILES "${3RDPARTY_TBB_DLL}" "${3RDPARTY_TBB_MALLOC_DLL}" DESTINATION "${INSTALL_DIR}/${DLL_SO_FOLDER}")
SET(3RDPARTY_TBB_DLL_DIR "")
SET(3RDPARTY_TBB_MALLOC_DLL_DIR "")
ELSE()
GET_FILENAME_COMPONENT(3RDPARTY_TBB_DLL_DIR "${3RDPARTY_TBB_DLL}" PATH)
GET_FILENAME_COMPONENT(3RDPARTY_TBB_MALLOC_DLL_DIR "${3RDPARTY_TBB_MALLOC_DLL}" PATH)
ENDIF()
ENDIF()
string( REGEX REPLACE ";" " " 3RDPARTY_NOT_INCLUDED "${3RDPARTY_NOT_INCLUDED}")
#CHECK ALL 3RDPARTY PATHS
IF(3RDPARTY_NOT_INCLUDED)
MESSAGE(FATAL_ERROR "NOT FOUND: ${3RDPARTY_NOT_INCLUDED}" )
ENDIF()
list(REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
string( REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
MESSAGE(STATUS "3RDPARTY_INCLUDE_DIRS: ${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
include_directories( ${3RDPARTY_INCLUDE_DIRS} )
list(REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
string( REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
MESSAGE(STATUS "3RDPARTY_LIBRARY_DIRS: ${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
link_directories( ${3RDPARTY_LIBRARY_DIRS} )
#
SET(RUN_PROJECT "")
SET(CASROOT_DEFINITION "set \"CASROOT=${CMAKE_SOURCE_DIR}\"")
SET(BIN_DIR_POSTFIX "bin")
SET(RESOURCE_DIR_PREFIX "%SCRIPTROOT%\\src")
IF("${INSTALL_DIR}" STREQUAL "")
MESSAGE(FATAL_ERROR "INSTALL_DIR is empty")
ELSE()
# inc,data,tests DIRECTORY
install(DIRECTORY "${CMAKE_SOURCE_DIR}/inc" DESTINATION "${INSTALL_DIR}" )
install(DIRECTORY "${CMAKE_SOURCE_DIR}/data" DESTINATION "${INSTALL_DIR}" )
IF(INSTALL_TESTS)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/tests" DESTINATION "${INSTALL_DIR}" )
ENDIF()
# DRAW.BAT or DRAW.SH
install(FILES "${CMAKE_SOURCE_DIR}/adm/cmake/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_WRITE WORLD_EXECUTE)
configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.${SCRIPT_EXT}.in" env.${SCRIPT_EXT} @ONLY)
install(FILES "${OCCT_BINARY_DIR}/env.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" )
ENDIF()
IF(MSVC AND "${BUILD_TYPE}" STREQUAL "Debug")
SET(RUN_PROJECT "start OCCT.sln")
SET(BIN_DIR_POSTFIX "out\\bin\\Debug")
SET(RESOURCE_DIR_PREFIX "%CASROOT%\\src")
configure_file("${CMAKE_SOURCE_DIR}/adm/cmake/env.bat.in" OCCT.bat @ONLY)
ENDIF()
include(adm/cmake/CMakeToolKitsDeps.txt)

View File

@@ -146,6 +146,7 @@ p GeomPlate
p HLRAlgo
p HLRBRep
p HLRTopoBRep
p HLRAppli
p Hatch
p HatchGen
p IntCurve
@@ -205,7 +206,6 @@ t TKTopAlgo
t TKXMesh
n InterfaceGraphic
p AIS
p AlienImage
p Aspect
p DsgPrs
p Graphic3d

View File

@@ -1,3 +1,4 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd"

View File

@@ -1,6 +1,4 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
if ["%CASDEB%"] == [""] (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% "" "%~dp0All-%VCVER%.sln"

View File

@@ -7,8 +7,7 @@ if ["%4"] == [""] (
exit /B
)
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
if not exist "%~dp0%BIN_DIR%\%4.exe" goto err_exe

View File

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

View File

@@ -5,8 +5,7 @@ REM Use first argument to specify version of Visual Studio (vc8, vc9, or vc10),
REM second argument specifies architecture) (win32 or win64)
REM third argument specifies Debug or Release mode
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
if not "%1" == "" (
if /I "%1" == "vc8" (

View File

@@ -1,5 +1,4 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
if ["%CASDEB%"] == [""] (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% "" "%~dp0IESample-%VCVER%.sln"

View File

@@ -1,5 +1,4 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
set "BIN_DIR=win%ARCH%\%VCVER%\bind"

View File

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

View File

@@ -5,8 +5,7 @@ REM Use first argument to specify version of Visual Studio (vc8, vc9, or vc10),
REM second argument specifies architecture) (win32 or win64)
REM third argument specifies Debug or Release mode
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
if not "%1" == "" (
if /I "%1" == "vc8" (

View File

@@ -1,5 +1,4 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
if ["%CASDEB%"] == [""] (
call "%~dp0..\..\..\msvc.bat" %VCVER% win%ARCH% "" "%~dp0Tutorial-%VCVER%.sln"

View File

@@ -1,5 +1,4 @@
call "%~dp0..\..\..\env.bat" %1 %2 %3
call "%~dp0env.bat"
call "%~dp0env.bat" %1 %2 %3
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
if ["%CASDEB%"] == [""] (

View File

@@ -213,8 +213,8 @@ void AIS_EqualDistanceRelation::Compute( const Handle( PrsMgr_PresentationManage
//purpose : to avoid warning at compilation (SUN)
//=======================================================================
void AIS_EqualDistanceRelation::Compute( const Handle( Prs3d_Projector )& aProjector,
const Handle( Prs3d_Presentation )& aPresentation)
void AIS_EqualDistanceRelation::Compute( const Handle( Prs3d_Projector )& /*aProjector*/,
const Handle( Prs3d_Presentation )& /*aPresentation*/)
{
// Standard_NotImplemented::Raise("AIS_EqualDistanceRelation::Compute( const Handle( Prs3d_Projector )&,
// const Handle( Prs3d_Presentation )& )");

View File

@@ -34,7 +34,7 @@ mySubInt(Standard_False)
AIS_GlobalStatus::AIS_GlobalStatus(const AIS_DisplayStatus DS,
const Standard_Integer DMode,
const Standard_Integer SMode,
const Standard_Boolean ishilighted,
const Standard_Boolean /*ishilighted*/,
const Quantity_NameOfColor TheHiCol,
const Standard_Integer Layer):
myStatus(DS),

View File

@@ -199,6 +199,16 @@ void AIS_InteractiveContext::Delete() const
// be performed when mgrSelector will be destroyed but anyway...
mgrSelector->Remove( myMainSel );
#endif
AIS_ListOfInteractive aList;
AIS_DataMapIteratorOfDataMapOfIOStatus anIt(myObjects);
Handle(AIS_InteractiveContext) aNullContext;
for(; anIt.More() ; anIt.Next())
{
Handle(AIS_InteractiveObject) anObj = anIt.Key();
anObj->SetContext(aNullContext);
}
MMgt_TShared::Delete();
}

View File

@@ -155,6 +155,8 @@ Handle(AIS_InteractiveContext) AIS_InteractiveObject::GetContext() const
void AIS_InteractiveObject::SetContext(const Handle(AIS_InteractiveContext)& aCtx)
{
myCTXPtr = aCtx.operator->();
if( aCtx.IsNull())
return;
if (myDrawer.IsNull()) {
myDrawer = new AIS_Drawer;
#ifdef DEB

View File

@@ -103,7 +103,7 @@ AIS_LocalContext::AIS_LocalContext(const Handle(AIS_InteractiveContext)& aCtx,
const Standard_Boolean LoadDisplayed,
const Standard_Boolean AcceptStandardModes,
const Standard_Boolean AcceptEraseOfTemp,
const Standard_Boolean BothViewers):
const Standard_Boolean /*BothViewers*/):
myCTX(aCtx),
myLoadDisplayed(LoadDisplayed),
myAcceptStdMode(AcceptStandardModes),

View File

@@ -284,8 +284,6 @@ AIS_SelectStatus AIS_Selection::Select(const Handle(Standard_Transient)& anObjec
S->myResultMap.Bind( anObject, aListIter );
return AIS_SS_Added;
#endif //USE_MAP
return AIS_SS_Removed;
}
//=======================================================================

View File

@@ -225,11 +225,10 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
Standard_Real prevcoeff ;
Standard_Real newcoeff ;
if (OwnDeviationAngle(newangle,prevangle) ||
OwnDeviationCoefficient(newcoeff,prevcoeff))
if (Abs (newangle - prevangle) > Precision::Angular() ||
Abs (newcoeff - prevcoeff) > Precision::Confusion() ) {
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
#ifdef DEB
cout << "AIS_Shape : compute"<<endl;
cout << "newangl : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;
@@ -326,9 +325,10 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
// coefficients for calculation
Standard_Real prevangle, newangle ,prevcoeff,newcoeff ;
if (OwnHLRDeviationAngle(newangle,prevangle) || OwnHLRDeviationCoefficient(newcoeff, prevcoeff))
if (Abs (newangle - prevangle) > Precision::Angular() ||
Abs (newcoeff - prevcoeff) > Precision::Confusion() ) {
Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle(newangle,prevangle);
Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient(newcoeff,prevcoeff);
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient)) {
#ifdef DEB
cout << "AIS_Shape : compute"<<endl;
cout << "newangle : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;

View File

@@ -61,11 +61,9 @@ is
SetTextureFileName( me: mutable;
TextureFileName: AsciiString from TCollection)
is virtual;
---Purpose : Sets the name of the texture file to map. The accepted
-- file types are those used in AlienImage with extensions
-- such as xwd, bmp, gif, rgb, ras, rs and more.
-- file types are those used in Image_AlienPixMap with extensions
-- such as rgb, png, jpg and more.
------------------------------------------------------------

View File

@@ -273,13 +273,12 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
Standard_Real prevcoeff;
Standard_Real newcoeff;
if (OwnDeviationAngle (newangle, prevangle) || OwnDeviationCoefficient (newcoeff, prevcoeff))
{
if (Abs (newangle - prevangle) > Precision::Angular() || Abs (newcoeff - prevcoeff) > Precision::Confusion())
{
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
BRepTools::Clean (myshape);
}
}
if (myshape.ShapeType() > TopAbs_FACE)
{
StdPrs_WFDeflectionShape::Add (thePrs, myshape, myDrawer);

View File

@@ -47,7 +47,7 @@ AIS_Triangulation::AIS_Triangulation(const Handle(Poly_Triangulation)& Triangula
//function : Compute
//purpose :
//=======================================================================
void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
@@ -134,7 +134,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
//function : ComputeSelection
//purpose :
//=======================================================================
void AIS_Triangulation::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
void AIS_Triangulation::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/)
{

View File

@@ -639,8 +639,19 @@ void AIS_Trihedron::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
{
// Standard_Boolean same_DA = myDrawer->Link() == Ctx->DefaultDrawer();
if( Ctx.IsNull())
{
Standard_Integer anIdx;
for (anIdx = 0; anIdx < 7; anIdx++)
{
myShapes[anIdx]->SetContext(Ctx);
}
AIS_InteractiveObject::SetContext (Ctx);
return;
}
// Remove subobjects from current context
Handle(AIS_InteractiveContext) anAISContext = GetContext();
Standard_Boolean hasContext = (anAISContext.IsNull() == Standard_False);
Standard_Integer anIdx;
for (anIdx = 0; anIdx < 7; anIdx++)
@@ -657,7 +668,6 @@ void AIS_Trihedron::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
}
AIS_InteractiveObject::SetContext (Ctx);
LoadSubObjects();
for(Standard_Integer i= 0;i<=6;i++)
myShapes[i]->SetContext (Ctx);

View File

@@ -38,19 +38,16 @@ static Standard_Boolean IsTimeStamp
case 4 : if (uncar < '0' || uncar > '9') return Standard_False; break;
case 5 : if (uncar != '-') return Standard_False;
case 6 : if (uncar != '0' && uncar != '1') return Standard_False; break;
case 7 : if (uncar < '0' || uncar > '9') return Standard_False; break;
if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False;
break;
case 7 : if (uncar < '0' || uncar > '9') return Standard_False;
if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False; break;
case 8 : if (uncar != '-') return Standard_False;
case 9 : if (uncar < '0' || uncar > '3') return Standard_False; break;
case 10 : if (uncar < '0' || uncar > '9') return Standard_False;
if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False;
break;
if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False; break;
case 11 : if (uncar != 'T') return Standard_False;
case 12 : if (uncar < '0' || uncar > '2') return Standard_False; break;
case 13 : if (uncar < '0' || uncar > '9') return Standard_False;
if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; break;
break;
case 14 : if (uncar != ':') return Standard_False;
case 15 : if (uncar < '0' || uncar > '5') return Standard_False; break;
case 16 : if (uncar < '0' || uncar > '9') return Standard_False; break;
@@ -99,11 +96,11 @@ static Standard_Boolean IsTimeStamp
{ return TCollection_AsciiString ("Step Header"); }
Standard_Boolean APIHeaderSection_EditHeader::Recognize
(const Handle(IFSelect_EditForm)& form) const
(const Handle(IFSelect_EditForm)& /*form*/) const
{ return Standard_True; } // ??
Handle(TCollection_HAsciiString) APIHeaderSection_EditHeader::StringValue
(const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const
(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
{
// Default Values
return TypedValue(num)->HStringValue();
@@ -111,7 +108,7 @@ static Standard_Boolean IsTimeStamp
Standard_Boolean APIHeaderSection_EditHeader::Load
(const Handle(IFSelect_EditForm)& form,
const Handle(Standard_Transient)& ent,
const Handle(Standard_Transient)& /*ent*/,
const Handle(Interface_InterfaceModel)& model) const
{
Handle(StepData_StepModel) modl =
@@ -138,7 +135,7 @@ static Standard_Boolean IsTimeStamp
Standard_Boolean APIHeaderSection_EditHeader::Apply
(const Handle(IFSelect_EditForm)& form,
const Handle(Standard_Transient)& ent,
const Handle(Standard_Transient)& /*ent*/,
const Handle(Interface_InterfaceModel)& model) const
{
Handle(StepData_StepModel) modl =

View File

@@ -805,11 +805,8 @@ gp_Elips Adaptor3d_IsoCurve::Ellipse() const
default:
{
Standard_NoSuchObject::Raise("Adaptor3d_IsoCurve:Ellipse");
return gp_Elips();
}
}
// portage WNT
return gp_Elips();
}

View File

@@ -193,9 +193,8 @@ Handle(Adaptor3d_HSurface) Adaptor3d_SurfaceOfLinearExtrusion::VTrim
const Standard_Real Tol) const
{
Handle(Adaptor3d_HCurve) newBasisCurve =
myBasisCurve->Trim(First,
Last,
Tol) ;
myBasisCurve->Trim(First, Last, Tol);
Adaptor3d_SurfaceOfLinearExtrusion * SurfacePtr =
new Adaptor3d_SurfaceOfLinearExtrusion(newBasisCurve, myDirection) ;
@@ -492,9 +491,6 @@ GeomAbs_SurfaceType Adaptor3d_SurfaceOfLinearExtrusion::GetType() const
return GeomAbs_SurfaceOfExtrusion;
}
// portage WNT
return GeomAbs_SurfaceOfExtrusion;
}
//=======================================================================

View File

@@ -283,9 +283,6 @@ Handle(Adaptor3d_HSurface) Adaptor3d_SurfaceOfRevolution::UTrim
Last
#endif
,const Standard_Real
#ifndef No_Exception
Tol
#endif
) const
{
#ifndef No_Exception

View File

@@ -976,6 +976,23 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
Standard_Boolean bUuniform = Standard_False;
Standard_Boolean bVuniform = Standard_False;
//modified by NIZHNY-EMV Mon Jun 10 14:19:04 2013
if (nbsu < theNUmin || nbsv < theNVmin) {
Standard_Integer aNb;
if (nbsu < nbsv) {
aNb = (Standard_Integer)(nbsv * ((Standard_Real)theNUmin)/((Standard_Real)nbsu));
aNb = Min(aNb, 30);
bVuniform = (aNb > nbsv) ? Standard_True : bVuniform;
nbsv = bVuniform ? aNb : nbsv;
} else {
aNb = (Standard_Integer)(nbsu * ((Standard_Real)theNVmin)/((Standard_Real)nbsv));
aNb = Min(aNb, 30);
bUuniform = (aNb > nbsu) ? Standard_True : bUuniform;
nbsu = bUuniform ? aNb : nbsu;
}
}
//modified by NIZHNY-EMV Mon Jun 10 14:19:05 2013
if(nbsu < theNUmin) {
nbsu = theNUmin;
bUuniform = Standard_True;

View File

@@ -277,7 +277,7 @@ int mma1cdi_(integer *ndimen,
doublereal *hermit,
integer *iercod)
{
static integer c__1 = 1;
integer c__1 = 1;
/* System generated locals */
integer contr1_dim1, contr1_offset, contr2_dim1, contr2_offset,
@@ -286,9 +286,9 @@ int mma1cdi_(integer *ndimen,
i__2, i__3;
/* Local variables */
static integer nroo2, ncfhe, nd, ii, kk;
static integer ibb, kkm, kkp;
static doublereal bid1, bid2, bid3;
integer nroo2, ncfhe, nd, ii, kk;
integer ibb, kkm, kkp;
doublereal bid1, bid2, bid3;
/* **********************************************************************
*/
@@ -505,8 +505,8 @@ int mma1cnt_(integer *ndimen,
i__2, i__3;
/* Local variables */
static integer nd, ii, jj, ibb;
static doublereal bid;
integer nd, ii, jj, ibb;
doublereal bid;
/* ***********************************************************************
@@ -643,10 +643,10 @@ int mma1fdi_(integer *ndimen,
doublereal d__1;
/* Local variables */
static integer ideb, ifin, nroo2, ideru, iderv;
static doublereal renor;
static integer ii, nd, ibb, iim, nbp, iip;
static doublereal bid1, bid2;
integer ideb, ifin, nroo2, ideru, iderv;
doublereal renor;
integer ii, nd, ibb, iim, nbp, iip;
doublereal bid1, bid2;
/* **********************************************************************
*/
@@ -971,8 +971,8 @@ int mma1fer_(integer *,//ndimen,
integer crvjac_dim1, crvjac_offset, i__1, i__2;
/* Local variables */
static integer idim, ncfja, ncfnw, ndses, ii, kk, ibb, ier;
static integer nbr0;
integer idim, ncfja, ncfnw, ndses, ii, kk, ibb, ier = 0;
integer nbr0;
/* ***********************************************************************
@@ -1165,7 +1165,7 @@ int AdvApp2Var_ApproxF2var::mma1her_(const integer *iordre,
integer hermit_dim1, hermit_offset;
/* Local variables */
static integer ibb;
integer ibb;
@@ -1333,7 +1333,7 @@ int mma1jak_(integer *ndimen,
crvjac_dim1, crvjac_offset, cgauss_dim1;
/* Local variables */
static integer ibb;
integer ibb;
/* **********************************************************************
*/
@@ -1448,9 +1448,9 @@ int mma1noc_(doublereal *dfuvin,
doublereal d__1;
/* Local variables */
static doublereal rider, riord;
static integer nd, ibb;
static doublereal bid;
doublereal rider, riord;
integer nd, ibb;
doublereal bid;
/* **********************************************************************
*/
@@ -1581,8 +1581,8 @@ int mma1nop_(integer *nbroot,
integer i__1;
/* Local variables */
static doublereal alinu, blinu, alinv, blinv;
static integer ii, ibb;
doublereal alinu, blinu, alinv, blinv;
integer ii, ibb;
/* ***********************************************************************
*/
@@ -1700,11 +1700,11 @@ int AdvApp2Var_ApproxF2var::mma2ac1_(integer const *ndimen,
patjac_dim2, patjac_offset, i__1, i__2, i__3, i__4, i__5;
/* Local variables */
static logical ldbg;
static integer ndgu, ndgv;
static doublereal bidu1, bidu2, bidv1, bidv2;
static integer ioru1, iorv1, ii, nd, jj, ku, kv;
static doublereal cnt1, cnt2, cnt3, cnt4;
logical ldbg;
integer ndgu, ndgv;
doublereal bidu1, bidu2, bidv1, bidv2;
integer ioru1, iorv1, ii, nd, jj, ku, kv;
doublereal cnt1, cnt2, cnt3, cnt4;
/* **********************************************************************
*/
@@ -1865,9 +1865,9 @@ int AdvApp2Var_ApproxF2var::mma2ac2_(const integer *ndimen,
vhermt_dim1, vhermt_offset, i__1, i__2, i__3, i__4;
/* Local variables */
static logical ldbg;
static integer ndgv1, ndgv2, ii, jj, nd, kk;
static doublereal bid1, bid2;
logical ldbg;
integer ndgv1, ndgv2, ii, jj, nd, kk;
doublereal bid1, bid2;
/* **********************************************************************
*/
@@ -2011,9 +2011,9 @@ int AdvApp2Var_ApproxF2var::mma2ac3_(const integer *ndimen,
uhermt_dim1, uhermt_offset, i__1, i__2, i__3, i__4;
/* Local variables */
static logical ldbg;
static integer ndgu1, ndgu2, ii, jj, nd, kk;
static doublereal bid1, bid2;
logical ldbg;
integer ndgu1, ndgu2, ii, jj, nd, kk;
doublereal bid1, bid2;
/* **********************************************************************
*/
@@ -2157,8 +2157,8 @@ int AdvApp2Var_ApproxF2var::mma2can_(const integer *ncfmxu,
patcan_offset, i__1, i__2;
/* Local variables */
static logical ldbg;
static integer ilon1, ilon2, ii, nd;
logical ldbg;
integer ilon1, ilon2, ii, nd;
/* **********************************************************************
*/
@@ -2310,7 +2310,7 @@ int mma2cd1_(integer *ndimen,
doublereal *diditb)
{
static integer c__1 = 1;
integer c__1 = 1;
/* System generated locals */
integer contr1_dim1, contr1_dim2, contr1_offset, contr2_dim1, contr2_dim2,
@@ -2324,10 +2324,10 @@ int mma2cd1_(integer *ndimen,
i__5;
/* Local variables */
static integer ncfhu, ncfhv, nuroo, nvroo, nd, ii, jj, kk, ll, ibb, kkm,
integer ncfhu, ncfhv, nuroo, nvroo, nd, ii, jj, kk, ll, ibb, kkm,
llm, kkp, llp;
static doublereal bid1, bid2, bid3, bid4;
static doublereal diu1, diu2, div1, div2, sou1, sou2, sov1, sov2;
doublereal bid1, bid2, bid3, bid4;
doublereal diu1, diu2, div1, div2, sou1, sou2, sov1, sov2;
/* **********************************************************************
*/
@@ -2670,7 +2670,7 @@ int mma2cd2_(integer *ndimen,
doublereal *diditb)
{
static integer c__1 = 1;
integer c__1 = 1;
/* System generated locals */
integer sotbv1_dim1, sotbv1_dim2, sotbv1_offset, sotbv2_dim1, sotbv2_dim2,
sotbv2_offset, ditbv1_dim1, ditbv1_dim2, ditbv1_offset,
@@ -2681,8 +2681,8 @@ int mma2cd2_(integer *ndimen,
disotb_dim1, disotb_dim2, disotb_offset, i__1, i__2, i__3, i__4;
/* Local variables */
static integer ncfhv, nuroo, nvroo, ii, nd, jj, kk, ibb, jjm, jjp;
static doublereal bid1, bid2, bid3, bid4;
integer ncfhv, nuroo, nvroo, ii, nd, jj, kk, ibb, jjm, jjp;
doublereal bid1, bid2, bid3, bid4;
/* **********************************************************************
*/
@@ -2982,7 +2982,7 @@ int mma2cd3_(integer *ndimen,
doublereal *diditb)
{
static integer c__1 = 1;
integer c__1 = 1;
/* System generated locals */
integer sotbu1_dim1, sotbu1_dim2, sotbu1_offset, sotbu2_dim1, sotbu2_dim2,
@@ -2994,8 +2994,8 @@ int mma2cd3_(integer *ndimen,
disotb_dim1, disotb_dim2, disotb_offset, i__1, i__2, i__3, i__4;
/* Local variables */
static integer ncfhu, nuroo, nvroo, ii, nd, jj, kk, ibb, kkm, kkp;
static doublereal bid1, bid2, bid3, bid4;
integer ncfhu, nuroo, nvroo, ii, nd, jj, kk, ibb, kkm, kkp;
doublereal bid1, bid2, bid3, bid4;
/* **********************************************************************
*/
@@ -3308,7 +3308,7 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen,
integer *iercod)
{
static integer c__8 = 8;
integer c__8 = 8;
/* System generated locals */
integer contr1_dim1, contr1_dim2, contr1_offset, contr2_dim1, contr2_dim2,
@@ -3319,13 +3319,13 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen,
disotb_offset;
/* Local variables */
static integer ilong;
static intptr_t iofwr;
static doublereal wrkar[1];
static integer iszwr;
static integer ibb, ier;
static integer isz1, isz2, isz3, isz4;
static intptr_t ipt1, ipt2, ipt3, ipt4;
integer ilong;
intptr_t iofwr;
doublereal* wrkar = 0;
integer iszwr;
integer ibb, ier;
integer isz1, isz2, isz3, isz4;
intptr_t ipt1, ipt2, ipt3, ipt4;
@@ -3471,6 +3471,7 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen,
--sotbv2;
--ditbv1;
--ditbv2;
AdvApp2Var_SysBase anAdvApp2Var_SysBase;
/* Function Body */
ibb = AdvApp2Var_SysBase::mnfndeb_();
@@ -3506,7 +3507,7 @@ int AdvApp2Var_ApproxF2var::mma2cdi_( integer *ndimen,
isz3 = ((*iordru + 1) << 1) * *nbpntu;
isz4 = ((*iordrv + 1) << 1) * *nbpntv;
iszwr = isz1 + isz2 + isz3 + isz4;
AdvApp2Var_SysBase::mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier);
anAdvApp2Var_SysBase.mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier);
if (ier > 0) {
goto L9013;
}
@@ -3579,7 +3580,7 @@ L9013:
L9999:
if (iofwr != 0) {
AdvApp2Var_SysBase::mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier);
anAdvApp2Var_SysBase.mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier);
}
if (ier > 0) {
*iercod = 13;
@@ -3623,7 +3624,7 @@ int AdvApp2Var_ApproxF2var::mma2ce1_(integer *numdec,
integer *iercod)
{
static integer c__8 = 8;
integer c__8 = 8;
/* System generated locals */
integer sosotb_dim1, sosotb_dim2, sosotb_offset, disotb_dim1, disotb_dim2,
@@ -3632,13 +3633,13 @@ int AdvApp2Var_ApproxF2var::mma2ce1_(integer *numdec,
patjac_offset;
/* Local variables */
static logical ldbg;
static intptr_t iofwr;
static doublereal wrkar[1];
static integer iszwr;
static integer ier;
static integer isz1, isz2, isz3, isz4, isz5, isz6, isz7;
static intptr_t ipt1, ipt2, ipt3, ipt4, ipt5, ipt6, ipt7;
logical ldbg;
intptr_t iofwr;
doublereal* wrkar = 0;
integer iszwr;
integer ier;
integer isz1, isz2, isz3, isz4, isz5, isz6, isz7;
intptr_t ipt1, ipt2, ipt3, ipt4, ipt5, ipt6, ipt7;
@@ -3799,7 +3800,8 @@ int AdvApp2Var_ApproxF2var::mma2ce1_(integer *numdec,
isz6 = *ndjacv + 1 - ((*iordrv + 1) << 1);
isz7 = *ndimen << 2;
iszwr = isz1 + isz2 + isz3 + isz4 + isz5 + isz6 + isz7;
AdvApp2Var_SysBase::mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier);
AdvApp2Var_SysBase anAdvApp2Var_SysBase;
anAdvApp2Var_SysBase.mcrrqst_(&c__8, &iszwr, wrkar, &iofwr, &ier);
if (ier > 0) {
goto L9013;
}
@@ -3853,7 +3855,7 @@ L9013:
L9999:
if (iofwr != 0) {
AdvApp2Var_SysBase::mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier);
anAdvApp2Var_SysBase.mcrdelt_(&c__8, &iszwr, wrkar, &iofwr, &ier);
}
if (ier > 0) {
*iercod = 13;
@@ -3913,12 +3915,12 @@ int mma2ce2_(integer *numdec,
patjac_offset, vecerr_dim1, vecerr_offset, i__1, i__2, i__3, i__4;
/* Local variables */
static logical ldbg;
static integer idim, igsu, minu, minv, maxu, maxv, igsv;
static doublereal vaux[3];
static integer i2rdu, i2rdv, ndses, nd, ii, jj, kk, nu, nv;
static doublereal zu, zv;
static integer nu1, nv1;
logical ldbg;
integer idim, igsu, minu, minv, maxu, maxv, igsv;
doublereal vaux[3];
integer i2rdu, i2rdv, ndses, nd, ii, jj, kk, nu, nv;
doublereal zu, zv;
integer nu1, nv1;
/* **********************************************************************
*/
@@ -4678,9 +4680,9 @@ int mma2cfu_(integer *ndujac,
soditb_offset, diditb_dim1, i__1, i__2;
/* Local variables */
static logical ldbg;
static integer nptu2, nptv2, ii, jj;
static doublereal bid0, bid1, bid2;
logical ldbg;
integer nptu2, nptv2, ii, jj;
doublereal bid0, bid1, bid2;
/* **********************************************************************
*/
@@ -4894,9 +4896,9 @@ int mma2cfv_(integer *ndvjac,
patjac_offset, i__1, i__2;
/* Local variables */
static logical ldbg;
static integer nptv2, ii, jj;
static doublereal bid1;
logical ldbg;
integer nptv2, ii, jj;
doublereal bid1;
/* **********************************************************************
*/
@@ -5052,9 +5054,9 @@ int AdvApp2Var_ApproxF2var::mma2ds1_(integer *ndimen,
fpntab_offset, i__1;
/* Local variables */
static logical ldbg;
static integer ibid1, ibid2, iuouv, nd;
static integer isz1, isz2;
logical ldbg;
integer ibid1, ibid2, iuouv, nd;
integer isz1, isz2;
/* **********************************************************************
*/
@@ -5365,7 +5367,7 @@ int mma2ds2_(integer *ndimen,
integer *iercod)
{
static integer c__0 = 0;
integer c__0 = 0;
/* System generated locals */
integer sosotb_dim1, sosotb_dim2, sosotb_offset, disotb_dim1, disotb_dim2,
disotb_offset, soditb_dim1, soditb_dim2, soditb_offset,
@@ -5373,12 +5375,12 @@ int mma2ds2_(integer *ndimen,
fpntab_offset, i__1, i__2, i__3;
/* Local variables */
static integer jdec;
static logical ldbg;
static doublereal alinu, blinu, alinv, blinv, tcons;
static doublereal dbfn1[2], dbfn2[2];
static integer nuroo, nvroo, id, iu, iv;
static doublereal um, up;
integer jdec;
logical ldbg;
doublereal alinu, blinu, alinv, blinv, tcons;
doublereal dbfn1[2], dbfn2[2];
integer nuroo, nvroo, id, iu, iv;
doublereal um, up;
/* **********************************************************************
@@ -5749,11 +5751,11 @@ int mma2er1_(integer *ndjacu,
doublereal d__1;
/* Local variables */
static logical ldbg;
static integer minu, minv;
static doublereal vaux[2];
static integer ii, nd, jj;
static doublereal bid0, bid1;
logical ldbg;
integer minu, minv;
doublereal vaux[2];
integer ii, nd, jj;
doublereal bid0, bid1;
/* **********************************************************************
*/
@@ -5915,12 +5917,12 @@ int mma2er2_(integer *ndjacu,
doublereal d__1;
/* Local variables */
static logical ldbg;
static doublereal vaux[2];
static integer i2rdu, i2rdv;
static doublereal errnu, errnv;
static integer ii, nd, jj, nu, nv;
static doublereal bid0, bid1;
logical ldbg;
doublereal vaux[2];
integer i2rdu, i2rdv;
doublereal errnu, errnv;
integer ii, nd, jj, nu, nv;
doublereal bid0, bid1;
/* **********************************************************************
*/
@@ -6155,7 +6157,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen,
integer *iercod)
{
static integer c__8 = 8;
integer c__8 = 8;
/* System generated locals */
integer courbe_dim1, courbe_dim2, courbe_offset, somtab_dim1, somtab_dim2,
@@ -6166,22 +6168,22 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen,
doublereal d__1;
/* Local variables */
static integer ideb;
static doublereal tmil;
static integer ideb1, ibid1, ibid2, ncfja, ndgre, ilong,
integer ideb;
doublereal tmil;
integer ideb1, ibid1, ibid2, ncfja, ndgre, ilong,
ndwrk;
static doublereal wrkar[1];
static integer nupil;
static intptr_t iofwr;
static doublereal uvpav[4] /* was [2][2] */;
static integer nd, ii;
static integer ibb;
static integer ier;
static doublereal uv11[4] /* was [2][2] */;
static integer ncb1;
static doublereal eps3;
static integer isz1, isz2, isz3, isz4, isz5;
static intptr_t ipt1, ipt2, ipt3, ipt4, ipt5,iptt, jptt;
doublereal* wrkar = 0;
integer nupil;
intptr_t iofwr;
doublereal uvpav[4] /* was [2][2] */;
integer nd, ii;
integer ibb;
integer ier = 0;
doublereal uv11[4] /* was [2][2] */;
integer ncb1;
doublereal eps3;
integer isz1, isz2, isz3, isz4, isz5;
intptr_t ipt1, ipt2, ipt3, ipt4, ipt5,iptt, jptt;
/* **********************************************************************
*/
@@ -6370,6 +6372,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen,
courbe_dim2 = *ndimen;
courbe_offset = courbe_dim1 * (courbe_dim2 + 1) + 1;
courbe -= courbe_offset;
AdvApp2Var_SysBase anAdvApp2Var_SysBase;
/* Function Body */
ibb = AdvApp2Var_SysBase::mnfndeb_();
@@ -6429,7 +6432,7 @@ int AdvApp2Var_ApproxF2var::mma2fnc_(integer *ndimen,
isz5 = (*ndgjac + 1) * *ndimen;
ndwrk = isz1 + isz2 + isz3 + isz4 + isz5;
AdvApp2Var_SysBase::mcrrqst_(&c__8, &ndwrk, wrkar, &iofwr, &ier);
anAdvApp2Var_SysBase.mcrrqst_(&c__8, &ndwrk, wrkar, &iofwr, &ier);
if (ier > 0) {
goto L9013; }
/* --> For the parameters of discretisation (NBROOT+2 extremities). */
@@ -6666,7 +6669,7 @@ L9100:
L9900:
if (iofwr != 0) {
AdvApp2Var_SysBase::mcrdelt_(&c__8, &ndwrk, wrkar, &iofwr, &ier);
anAdvApp2Var_SysBase.mcrdelt_(&c__8, &ndwrk, wrkar, &iofwr, &ier);
}
if (ier > 0) {
*iercod = 13;
@@ -6715,9 +6718,9 @@ int AdvApp2Var_ApproxF2var::mma2fx6_(integer *ncfmxu,
doublereal d__1, d__2;
/* Local variables */
static integer idim, ncfu, ncfv, id, ii, nd, jj, ku, kv, ns, ibb;
static doublereal bid;
static doublereal tol;
integer idim, ncfu, ncfv, id, ii, nd, jj, ku, kv, ns, ibb;
doublereal bid;
doublereal tol;
/* **********************************************************************
*/
@@ -7146,9 +7149,9 @@ int AdvApp2Var_ApproxF2var::mma2jmx_(integer *ndgjac,
integer i__1;
/* Local variables */
static logical ldbg;
static integer numax, ii;
static doublereal bid;
logical ldbg;
integer numax, ii;
doublereal bid;
/* **********************************************************************
@@ -7250,9 +7253,9 @@ int mma2moy_(integer *ndgumx,
integer patjac_dim1, patjac_dim2, patjac_offset, i__1, i__2, i__3;
/* Local variables */
static logical ldbg;
static integer minu, minv, idebu, idebv, ii, nd, jj;
static doublereal bid0, bid1;
logical ldbg;
integer minu, minv, idebu, idebv, ii, nd, jj;
doublereal bid0, bid1;
/* **********************************************************************
@@ -7397,7 +7400,7 @@ int AdvApp2Var_ApproxF2var::mma2roo_(integer *nbpntu,
integer i__1;
/* Local variables */
static integer ii, ibb;
integer ii, ibb;
/* **********************************************************************
*/
@@ -7503,9 +7506,9 @@ int mmmapcoe_(integer *ndim,
crvjac_dim1, crvjac_offset, gsstab_dim1, i__1, i__2, i__3;
/* Local variables */
static integer igss, ikdeb;
static doublereal bidon;
static integer nd, ik, ir, nbroot, ibb;
integer igss, ikdeb;
doublereal bidon;
integer nd, ik, ir, nbroot, ibb;
/* **********************************************************************
*/
@@ -7664,9 +7667,9 @@ int mmaperm_(integer *ncofmx,
integer crvjac_dim1, crvjac_offset, i__1, i__2;
/* Local variables */
static doublereal bidj;
static integer i__, ia, nd, ncfcut, ibb;
static doublereal bid;
doublereal bidj;
integer i__, ia, nd, ncfcut, ibb;
doublereal bid;
/* **********************************************************************
*/
@@ -7773,7 +7776,7 @@ int AdvApp2Var_ApproxF2var::mmapptt_(const integer *ndgjac,
integer cgauss_dim1, i__1;
/* Local variables */
static integer kjac, iptt, ipdb0, infdg, iptdb, mxjac, ilong, ibb;
integer kjac, iptt, ipdb0, infdg, iptdb, mxjac, ilong, ibb;
/* **********************************************************************
*/
@@ -8077,7 +8080,7 @@ int mmjacpt_(const integer *ndimen,
ptcaux_offset, i__1, i__2, i__3;
/* Local variables */
static integer kdim, nd, ii, jj, ibb;
integer kdim, nd, ii, jj, ibb;
/* ***********************************************************************
*/

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@
// and conditions governing the rights and limitations under the License.
// AdvApp2Var_SysBase.cxx
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
@@ -34,9 +35,6 @@ int __s__cmp();
static
int macrbrk_();
static
int macrchk_();
static
int macrclw_(intptr_t *iadfld,
intptr_t *iadflf,
@@ -121,24 +119,11 @@ int mcrgetv_(integer *sz,
void* *iad,
integer *ier);
static
int mcrlist_(integer *ier);
static
int mcrlocv_(void* t,
intptr_t *l);
/* Structures */
static struct {
intptr_t icore[12000];
integer ncore, lprot;
} mcrgene_;
static struct {
integer nrqst[2], ndelt[2], nbyte[2], mbyte[2];
} mcrstac_;
static struct {
integer lec, imp, keyb, mae, jscrn, itblt, ibb;
} mblank__;
@@ -146,6 +131,25 @@ static struct {
#define mcrfill_ABS(a) (((a)<0)?(-(a)):(a))
//=======================================================================
//function : AdvApp2Var_SysBase
//purpose :
//=======================================================================
AdvApp2Var_SysBase::AdvApp2Var_SysBase()
{
mainial_();
memset (&mcrstac_, 0, sizeof (mcrstac_));
}
//=======================================================================
//function : ~AdvApp2Var_SysBase
//purpose :
//=======================================================================
AdvApp2Var_SysBase::~AdvApp2Var_SysBase()
{
assert (mcrgene_.ncore == 0); //otherwise memory leaking
}
//=======================================================================
//function : macinit_
//purpose :
@@ -156,7 +160,7 @@ int AdvApp2Var_SysBase::macinit_(integer *imode,
{
/* Fortran I/O blocks */
static cilist io______1 = { 0, 0, 0, (char*) "(' --- Debug-mode : ',I10,' ---')", 0 };
cilist io______1 = { 0, 0, 0, (char*) "(' --- Debug-mode : ',I10,' ---')", 0 };
/* ************************************************************************/
/* FUNCTION : */
@@ -292,14 +296,12 @@ int AdvApp2Var_SysBase::macrai4_(integer *nbelem,
*/
integer iunit;
/* Parameter adjustments */
--itablo;
iunit = sizeof(integer);
/* Function Body */
if (*nbelem > *maxelm) {
AdvApp2Var_SysBase::mcrrqst_(&iunit, nbelem, &itablo[1], iofset, iercod);
/*AdvApp2Var_SysBase::*/mcrrqst_(&iunit, nbelem, itablo, iofset, iercod);
} else {
*iercod = 0;
*iofset = 0;
@@ -318,7 +320,7 @@ int AdvApp2Var_SysBase::macrar8_(integer *nbelem,
integer *iercod)
{
static integer c__8 = 8;
integer c__8 = 8;
/* ***********************************************************************
*/
@@ -366,12 +368,9 @@ int AdvApp2Var_SysBase::macrar8_(integer *nbelem,
*/
/* Parameter adjustments */
--xtablo;
/* Function Body */
if (*nbelem > *maxelm) {
AdvApp2Var_SysBase::mcrrqst_(&c__8, nbelem, &xtablo[1], iofset, iercod);
/*AdvApp2Var_SysBase::*/mcrrqst_(&c__8, nbelem, xtablo, iofset, iercod);
} else {
*iercod = 0;
*iofset = 0;
@@ -392,16 +391,16 @@ int macrbrk_()
//function : macrchk_
//purpose :
//=======================================================================
int macrchk_()
int AdvApp2Var_SysBase::macrchk_()
{
/* System generated locals */
integer i__1;
/* Local variables */
static integer i__, j;
static intptr_t ioff;
static doublereal t[1];
static intptr_t loc;
integer i__, j;
intptr_t ioff;
doublereal* t = 0;
intptr_t loc;
/* ***********************************************************************
*/
@@ -489,27 +488,28 @@ int macrchk_()
mcrlocv_(t, &loc);
/* CONTROL OF FLAGS IN THE TABLE */
i__1 = mcrgene_.ncore;
for (i__ = 1; i__ <= i__1; ++i__) {
for (i__ = 0; i__ < i__1; ++i__) {
for (j = 10; j <= 11; ++j) {
//p to access startaddr and endaddr
intptr_t* p = &mcrgene_.icore[i__].startaddr;
for (j = 0; j <= 1; ++j) {
intptr_t* pp = p + j;
if (*pp != -1) {
if (mcrgene_.icore[j + i__ * 12 - 13] != -1) {
ioff = (mcrgene_.icore[j + i__ * 12 - 13] - loc) / 8;
ioff = (*pp - loc) / 8;
if (t[ioff] != -134744073.) {
/* MSG : '*** ERREUR : REMOVAL FROM MEMORY OF ADDRESS
E:',ICORE(J,I) */
/* AND OF RANK ICORE(12,I) */
macrerr_(&mcrgene_.icore[j + i__ * 12 - 13],
&mcrgene_.icore[i__ * 12 - 1]);
macrerr_(pp, p + 2);
/* BACK-PARCING IN PHASE OF PRODUCTION */
maostrb_();
/* REMOVAL OF THE ADDRESS OF FLAG TO AVOID REMAKING ITS CONTROL */
mcrgene_.icore[j + i__ * 12 - 13] = -1;
*pp = -1;
}
@@ -587,14 +587,12 @@ int AdvApp2Var_SysBase::macrdi4_(integer *nbelem,
*/
integer iunit;
/* Parameter adjustments */
--itablo;
iunit = sizeof(integer);
/* Function Body */
if (*iofset != 0) {
AdvApp2Var_SysBase::mcrdelt_(&iunit,
nbelem,
&itablo[1],
itablo,
iofset,
iercod);
} else {
@@ -614,7 +612,7 @@ int AdvApp2Var_SysBase::macrdr8_(integer *nbelem,
integer *iercod)
{
static integer c__8 = 8;
integer c__8 = 8;
/* ***********************************************************************
*/
@@ -657,13 +655,9 @@ int AdvApp2Var_SysBase::macrdr8_(integer *nbelem,
/* ***********************************************************************
*/
/* Parameter adjustments */
--xtablo;
/* Function Body */
if (*iofset != 0) {
AdvApp2Var_SysBase::mcrdelt_(&c__8, nbelem, &xtablo[1], iofset, iercod);
AdvApp2Var_SysBase::mcrdelt_(&c__8, nbelem, xtablo, iofset, iercod);
} else {
*iercod = 0;
}
@@ -678,12 +672,12 @@ int macrerr_(intptr_t *,//iad,
intptr_t *)//nalloc)
{
//static integer c__1 = 1;
//integer c__1 = 1;
/* Builtin functions */
//integer /*s__wsfe(),*/ /*do__fio(),*/ e__wsfe();
/* Fortran I/O blocks */
//static cilist io___1 = { 0, 6, 0, "(X,A,I9,A,I3)", 0 };
//cilist io___1 = { 0, 6, 0, "(X,A,I9,A,I3)", 0 };
/* ***********************************************************************
*/
@@ -743,13 +737,18 @@ int macrgfl_(intptr_t *iadfld,
{
/* Initialized data */
static integer ifois = 0;
/* original code used static integer ifois=0 which served as static
initialization flag and was only used to call matrsym_() once; now
this flag is not used as matrsym_() always returns 0 and has no
useful contents
*/
integer ifois = 1;
static char cbid[1];
static integer ibid, ienr;
static doublereal t[1];
static integer novfl;
static intptr_t ioff,iadrfl, iadt;
char cbid[1];
integer ibid, ienr;
doublereal* t = 0;
integer novfl;
intptr_t ioff,iadrfl, iadt;
/* ***********************************************************************
@@ -889,13 +888,13 @@ int macrmsg_(const char *,//crout,
{
/* Local variables */
static integer inum, iunite;
static char cfm[80], cln[3];
integer inum, iunite;
char cfm[80], cln[3];
/* Fortran I/O blocks */
static cilist io___5 = { 0, 0, 0, cfm, 0 };
static cilist io___6 = { 0, 0, 0, cfm, 0 };
static cilist io___7 = { 0, 0, 0, cfm, 0 };
cilist io___5 = { 0, 0, 0, cfm, 0 };
cilist io___6 = { 0, 0, 0, cfm, 0 };
cilist io___7 = { 0, 0, 0, cfm, 0 };
/* ***********************************************************************
@@ -1211,8 +1210,8 @@ int magtlog_(const char *cnmlog,
{
/* Local variables */
static char cbid[255];
static integer ibid, ier;
char cbid[255];
integer ibid, ier;
/* **********************************************************************
@@ -1342,6 +1341,7 @@ int magtlog_(const char *cnmlog,
int AdvApp2Var_SysBase::mainial_()
{
mcrgene_.ncore = 0;
mcrgene_.lprot = 0;
return 0 ;
} /* mainial_ */
@@ -1354,11 +1354,11 @@ int AdvApp2Var_SysBase::maitbr8_(integer *itaill,
doublereal *xval)
{
static integer c__504 = 504;
integer c__504 = 504;
/* Initialized data */
static doublereal buff0[63] = {
doublereal buff0[63] = {
0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
@@ -1369,9 +1369,9 @@ int AdvApp2Var_SysBase::maitbr8_(integer *itaill,
integer i__1;
/* Local variables */
static integer i__;
static doublereal buffx[63];
static integer nbfois, noffst, nreste, nufois;
integer i__;
doublereal buffx[63];
integer nbfois, noffst, nreste, nufois;
/* ***********************************************************************
*/
@@ -1611,7 +1611,7 @@ int maostrb_()
//=======================================================================
int maostrd_()
{
static integer imod;
integer imod;
/* ***********************************************************************
*/
@@ -1671,15 +1671,15 @@ int maoverf_(integer *nbentr,
{
/* Initialized data */
static integer ifois = 0;
integer ifois = 0;
/* System generated locals */
integer i__1;
/* Local variables */
static integer ibid;
static doublereal buff[63];
static integer ioct, indic, nrest, icompt;
integer ibid;
doublereal buff[63];
integer ioct, indic, nrest, icompt;
/* ***********************************************************************
*/
@@ -1910,7 +1910,7 @@ int matrsym_(const char *cnmsym,
{
/* Local variables */
static char chainx[255];
char chainx[255];
/* ***********************************************************************
*/
@@ -1999,17 +1999,17 @@ int mcrcomm_(integer *kop,
{
/* Initialized data */
static integer ntab = 0;
integer ntab = 0;
/* System generated locals */
integer i__1, i__2;
/* Local variables */
static intptr_t ideb;
static doublereal dtab[32000];
static intptr_t itab[160] /* was [4][40] */;
static intptr_t ipre;
static integer i__, j, k;
intptr_t ideb;
doublereal dtab[32000];
intptr_t itab[160] /* was [4][40] */;
intptr_t ipre;
integer i__, j, k;
/************************************************************************
@@ -2177,12 +2177,12 @@ int AdvApp2Var_SysBase::mcrdelt_(integer *iunit,
integer *iercod)
{
static integer ibid;
static doublereal xbid;
static integer noct, iver, ksys, i__, n, nrang,
integer ibid;
doublereal xbid;
integer noct, iver, ksys, i__, n, nrang,
ibyte, ier;
static intptr_t iadfd, iadff, iaddr, loc; /* Les adrresses en long*/
static integer kop;
intptr_t iadfd, iadff, iaddr, loc; /* Les adrresses en long*/
integer kop;
/* ***********************************************************************
*/
@@ -2310,13 +2310,13 @@ int AdvApp2Var_SysBase::mcrdelt_(integer *iunit,
/* SEARCH IN MCRGENE */
n = 0;
n = -1;
mcrlocv_(t, &loc);
for (i__ = mcrgene_.ncore; i__ >= 1; --i__) {
if (*iunit == mcrgene_.icore[i__ * 12 - 11] && *isize ==
mcrgene_.icore[i__ * 12 - 10] && loc == mcrgene_.icore[i__ *
12 - 9] && *iofset == mcrgene_.icore[i__ * 12 - 8]) {
for (i__ = mcrgene_.ncore - 1; i__ >= 0; --i__) {
if (*iunit == mcrgene_.icore[i__].unit && *isize ==
mcrgene_.icore[i__].reqsize && loc == mcrgene_.icore[i__].loc
&& *iofset == mcrgene_.icore[i__].offset) {
n = i__;
goto L1100;
}
@@ -2326,18 +2326,18 @@ L1100:
/* IF THE ALLOCATION DOES NOT EXIST, LEAVE */
if (n <= 0) {
if (n < 0) {
goto L9003;
}
/* ALLOCATION RECOGNIZED : RETURN OTHER INFOS */
ksys = static_cast<integer> (mcrgene_.icore[n * 12 - 7]);
ibyte = static_cast<integer> (mcrgene_.icore[n * 12 - 6]);
iaddr = mcrgene_.icore[n * 12 - 5];
iadfd = mcrgene_.icore[n * 12 - 3];
iadff = mcrgene_.icore[n * 12 - 2];
nrang = static_cast<integer> (mcrgene_.icore[n * 12 - 1]);
ksys = mcrgene_.icore[n].alloctype;
ibyte = mcrgene_.icore[n].size;
iaddr = mcrgene_.icore[n].addr;
iadfd = mcrgene_.icore[n].startaddr;
iadff = mcrgene_.icore[n].endaddr;
nrang = mcrgene_.icore[n].rank;
/* Control of flags */
@@ -2346,7 +2346,7 @@ L1100:
macrchk_();
}
if (ksys <= 1) {
if (ksys == static_allocation) {
/* DE-ALLOCATION ON COMMON */
kop = 2;
mcrcomm_(&kop, &ibyte, &iaddr, &ier);
@@ -2366,22 +2366,16 @@ L1100:
macrclw_(&iadfd, &iadff, &nrang);
/* UPDATE OF STATISTICS */
if (ksys <= 1) {
i__ = 1;
} else {
i__ = 2;
}
++mcrstac_.ndelt[i__ - 1];
mcrstac_.nbyte[i__ - 1] -= static_cast<integer> (mcrgene_.icore[n * 12 - 11] *
mcrgene_.icore[n * 12 - 10]);
++mcrstac_.ndelt[ksys];
mcrstac_.nbyte[ksys] -= mcrgene_.icore[n].unit *
mcrgene_.icore[n].reqsize;
/* REMOVAL OF PARAMETERS IN MCRGENE */
if (n < 1000) {
/* noct = (mcrgene_1.ncore - n) * 48; */
noct = (mcrgene_.ncore - n) * 12 * sizeof(mcrgene_.icore[0]);
if (n < MAX_ALLOC_NB - 1) {
noct = (mcrgene_.ncore - (n + 1)) * sizeof(mcrgene_.icore[0]);
AdvApp2Var_SysBase::mcrfill_(&noct,
&mcrgene_.icore[(n + 1) * 12 - 12],
&mcrgene_.icore[n * 12 - 12]);
&mcrgene_.icore[n + 1],
&mcrgene_.icore[n]);
}
--mcrgene_.ncore;
@@ -2579,7 +2573,7 @@ int mcrgetv_(integer *sz,
//function : mcrlist_
//purpose :
//=======================================================================
int mcrlist_(integer *ier)
int AdvApp2Var_SysBase::mcrlist_(integer *ier) const
{
/* System generated locals */
@@ -2588,10 +2582,10 @@ int mcrlist_(integer *ier)
/* Builtin functions */
/* Local variables */
static char cfmt[1];
static doublereal dfmt;
static integer ifmt, i__, nufmt, ntotal;
static char subrou[7];
char cfmt[1];
doublereal dfmt;
integer ifmt, i__, nufmt, ntotal;
char subrou[7];
/************************************************************************
@@ -2703,9 +2697,9 @@ int mcrlist_(integer *ier)
ntotal = 0;
i__1 = mcrgene_.ncore;
for (i__ = 1; i__ <= i__1; ++i__) {
for (i__ = 0; i__ < i__1; ++i__) {
nufmt = 2;
ifmt = static_cast<integer> (mcrgene_.icore[i__ * 12 - 11] * mcrgene_.icore[i__ * 12 - 10])
ifmt = mcrgene_.icore[i__].unit * mcrgene_.icore[i__].reqsize
;
macrmsg_(subrou, &nufmt, &ifmt, &dfmt, cfmt, 7L, 1L);
ntotal += ifmt;
@@ -2747,12 +2741,12 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
integer i__1, i__2;
/* Local variables */
static doublereal dfmt;
static integer ifmt, iver;
static char subr[7];
static integer ksys , ibyte, irest, isyst, ier;
static intptr_t iadfd, iadff, iaddr,lofset, loc;
static integer izu;
doublereal dfmt;
integer ifmt, iver;
char subr[7];
integer ksys , ibyte, irest, isyst, ier;
intptr_t iadfd, iadff, iaddr,lofset, loc;
integer izu;
/* **********************************************************************
@@ -2904,7 +2898,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
/* Function Body */
*iercod = 0;
if (mcrgene_.ncore >= 1000) {
if (mcrgene_.ncore >= MAX_ALLOC_NB) {
goto L9001;
}
if (*iunit != 1 && *iunit != 2 && *iunit != 4 && *iunit != 8) {
@@ -2972,7 +2966,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
/* ENDIF */
/* ELSE */
/* ALLOCATION SYSTEME */
ksys = 2;
ksys = heap_allocation;
mcrgetv_(&ibyte, reinterpret_cast<void**> (&iaddr), &ier);
if (ier != 0) {
goto L9003;
@@ -3004,19 +2998,19 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
/* RANGING OF PARAMETERS IN MCRGENE */
mcrgene_.icore[mcrgene_.ncore].prot = mcrgene_.lprot;
mcrgene_.icore[mcrgene_.ncore].unit = (unsigned char)(*iunit);
mcrgene_.icore[mcrgene_.ncore].reqsize = *isize;
mcrgene_.icore[mcrgene_.ncore].loc = loc;
mcrgene_.icore[mcrgene_.ncore].offset = *iofset;
mcrgene_.icore[mcrgene_.ncore].alloctype = (unsigned char)ksys;
mcrgene_.icore[mcrgene_.ncore].size = ibyte;
mcrgene_.icore[mcrgene_.ncore].addr = iaddr;
mcrgene_.icore[mcrgene_.ncore].userzone = mcrgene_.ncore;
mcrgene_.icore[mcrgene_.ncore].startaddr = iadfd;
mcrgene_.icore[mcrgene_.ncore].endaddr = iadff;
mcrgene_.icore[mcrgene_.ncore].rank = mcrgene_.ncore + 1;
++mcrgene_.ncore;
mcrgene_.icore[mcrgene_.ncore * 12 - 12] = mcrgene_.lprot;
mcrgene_.icore[mcrgene_.ncore * 12 - 11] = *iunit;
mcrgene_.icore[mcrgene_.ncore * 12 - 10] = *isize;
mcrgene_.icore[mcrgene_.ncore * 12 - 9] = loc;
mcrgene_.icore[mcrgene_.ncore * 12 - 8] = *iofset;
mcrgene_.icore[mcrgene_.ncore * 12 - 7] = ksys;
mcrgene_.icore[mcrgene_.ncore * 12 - 6] = ibyte;
mcrgene_.icore[mcrgene_.ncore * 12 - 5] = iaddr;
mcrgene_.icore[mcrgene_.ncore * 12 - 4] = mcrgene_.ncore;
mcrgene_.icore[mcrgene_.ncore * 12 - 3] = iadfd;
mcrgene_.icore[mcrgene_.ncore * 12 - 2] = iadff;
mcrgene_.icore[mcrgene_.ncore * 12 - 1] = mcrgene_.ncore;
mcrgene_.lprot = 0;
@@ -3026,12 +3020,12 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
/* STATISTICS */
++mcrstac_.nrqst[ksys - 1];
mcrstac_.nbyte[ksys - 1] += static_cast<integer> (mcrgene_.icore[mcrgene_.ncore * 12 - 11] *
mcrgene_.icore[mcrgene_.ncore * 12 - 10]);
++mcrstac_.nrqst[ksys];
mcrstac_.nbyte[ksys] += mcrgene_.icore[mcrgene_.ncore - 1].unit *
mcrgene_.icore[mcrgene_.ncore - 1].reqsize;
/* Computing MAX */
i__1 = mcrstac_.mbyte[ksys - 1], i__2 = mcrstac_.nbyte[ksys - 1];
mcrstac_.mbyte[ksys - 1] = advapp_max(i__1,i__2);
i__1 = mcrstac_.mbyte[ksys], i__2 = mcrstac_.nbyte[ksys];
mcrstac_.mbyte[ksys] = advapp_max(i__1,i__2);
goto L9900;
@@ -3042,7 +3036,7 @@ int AdvApp2Var_SysBase::mcrrqst_(integer *iunit,
/* MAX NB OF ALLOC REACHED : */
L9001:
*iercod = 1;
ifmt = 1000;
ifmt = MAX_ALLOC_NB;
//__s__copy(subr, "MCRRQST", 7L, 7L);
macrmsg_(subr, iercod, &ifmt, &dfmt, " ", 7L, 1L);
maostrd_();
@@ -3175,7 +3169,7 @@ int AdvApp2Var_SysBase::msifill_(integer *nbintg,
integer *ivecin,
integer *ivecou)
{
static integer nocte;
integer nocte;
/* ***********************************************************************
*/
@@ -3230,7 +3224,7 @@ int AdvApp2Var_SysBase::msrfill_(integer *nbreel,
doublereal *vecent,
doublereal * vecsor)
{
static integer nocte;
integer nocte;
/* ***********************************************************************
@@ -3287,7 +3281,7 @@ int AdvApp2Var_SysBase::mswrdbg_(const char *,//ctexte,
{
static cilist io___1 = { 0, 0, 0, 0, 0 };
cilist io___1 = { 0, 0, 0, 0, 0 };
/* ***********************************************************************

View File

@@ -29,13 +29,16 @@
class AdvApp2Var_SysBase {
public:
Standard_EXPORT AdvApp2Var_SysBase();
Standard_EXPORT ~AdvApp2Var_SysBase();
//
Standard_EXPORT static int mainial_();
Standard_EXPORT int mainial_();
Standard_EXPORT static int macinit_(int *,
int *);
//
Standard_EXPORT static int mcrdelt_(integer *iunit,
Standard_EXPORT int mcrdelt_(integer *iunit,
integer *isize,
void *t,
intptr_t *iofset,
@@ -45,7 +48,7 @@ class AdvApp2Var_SysBase {
void *tin,
void *tout);
Standard_EXPORT static int mcrrqst_(integer *iunit,
Standard_EXPORT int mcrrqst_(integer *iunit,
integer *isize,
void *t,
intptr_t *iofset,
@@ -59,23 +62,23 @@ class AdvApp2Var_SysBase {
Standard_EXPORT static int e__wsle ();
Standard_EXPORT static int s__wsfe ();
Standard_EXPORT static int s__wsle ();
Standard_EXPORT static int macrai4_(integer *nbelem,
Standard_EXPORT int macrai4_(integer *nbelem,
integer *maxelm,
integer *itablo,
intptr_t *iofset,
integer *iercod);
Standard_EXPORT static int macrar8_(integer *nbelem,
Standard_EXPORT int macrar8_(integer *nbelem,
integer *maxelm,
doublereal *xtablo,
intptr_t *iofset,
integer *iercod);
Standard_EXPORT static int macrdi4_(integer *nbelem,
Standard_EXPORT int macrdi4_(integer *nbelem,
integer *maxelm,
integer *itablo,
intptr_t *iofset,
integer *iercod);
Standard_EXPORT static int macrdr8_(integer *nbelem,
Standard_EXPORT int macrdr8_(integer *nbelem,
integer *maxelm,
doublereal *xtablo,
intptr_t *iofset,
@@ -105,6 +108,64 @@ class AdvApp2Var_SysBase {
Standard_EXPORT static void mvriraz_(integer *taille,
void*adt);
private:
int macrchk_();
int mcrlist_(integer *ier) const;
/* Maximum number of allowed allocation requests.
Currently the maximum known number of requests is 7 - see
AdvApp2Var_MathBase::mmresol_(). So the current value is a safe margin and
a reasonable balance to not provoke stack overflow (especially in
multi-threaded execution). Previous number of 1000 was excessive but
tolerable when used for static memory.
*/
static const int MAX_ALLOC_NB = 32;
enum {
static_allocation = 0, /* indicates static allocation, currently not used */
heap_allocation = 1 /* indicates heap allocation */
};
/* Describes an individual memory allocation request.
See format description in the AdvApp2Var_SysBase.cxx.
The field order is preserved and the sizes are chosen to minimize
memory footprint. Fields containing address have the intptr_t type
for easier arithmetic and to avoid casts in the source code.
No initialization constructor should be provided to avoid wasting
time when allocating a field mcrgene_.
*/
struct mitem {
unsigned char prot;
unsigned char unit; //unit of allocation: 1, 2, 4 or 8
integer reqsize;
intptr_t loc;
intptr_t offset;
unsigned char alloctype; // static_allocation or heap_allocation
integer size;
intptr_t addr;
integer userzone; //not used
intptr_t startaddr;
intptr_t endaddr;
integer rank;
};
struct {
mitem icore[MAX_ALLOC_NB];
integer ncore;
unsigned char lprot;
} mcrgene_;
/* Contains statistics on allocation requests.
Index 0 corresponds to static_allocation, 1 - to heap allocation.
nrqst - number of allocation requests;
ndelt - number of deallocation requests;
nbyte - current number of allocated bytes;
mbyte - maximum number of ever allocated bytes.
*/
struct {
integer nrqst[2], ndelt[2], nbyte[2], mbyte[2];
} mcrstac_;
};
#endif

View File

@@ -25,8 +25,11 @@
static int init_STBAS(void)
{
int ICODE = 0;
//allocation tables are now local, so no global initialization is required
#if 0
// Init du Tableau des allocs
AdvApp2Var_SysBase::mainial_();
#endif
// Init de LEC IBB IMP
AdvApp2Var_SysBase::macinit_(&ICODE, &ICODE);
//

View File

@@ -786,13 +786,12 @@ void AdvApprox_ApproxAFunction::Perform(const Standard_Integer Num1DSS,
TColStd_Array1OfReal AverageError(1,myMaxSegments * TotalNumSS) ;
Approximation (TotalDimension, TotalNumSS, LocalDimension,
Approximation ( TotalDimension,
TotalNumSS, LocalDimension,
myFirst, myLast,
*(AdvApprox_EvaluatorFunction*)myEvaluator,
CutTool,
ContinuityOrder,
NumMaxCoeffs, myMaxSegments,
LocalTolerances, code_precis,
CutTool, ContinuityOrder, NumMaxCoeffs,
myMaxSegments, LocalTolerances, code_precis,
NumCurves, // Nombre de courbe en sortie
NumCoeffPerCurvePtr->ChangeArray1(), // Nbre de coeff par courbe
LocalCoefficientsPtr->ChangeArray1(), // Les Coeffs solutions
@@ -800,6 +799,7 @@ void AdvApprox_ApproxAFunction::Perform(const Standard_Integer Num1DSS,
ErrorMax, // Majoration de l'erreur
AverageError, // Erreur moyenne constatee
ErrorCode) ;
if (ErrorCode == 0 || ErrorCode == -1) {
//
// si tout est OK ou bien on a un resultat dont l une des erreurs max est

View File

@@ -1,148 +0,0 @@
-- Created on: 1993-07-27
-- Created by: Jean Louis FRENKEL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
package AlienImage
---Purpose: This package allows importation of images
-- from some other format into CAS.CADE format.
uses
Image,
TColStd,
TCollection,
Aspect,
OSD,
MMgt
is
------------------------
---Category: The classes
------------------------
deferred class AlienImage;
---Purpose: Define the general methods on AlienImage
deferred class AlienImageData ;
---Purpose: Internal Definition of AlienImage.
deferred class AlienUserImage ;
---Purpose: Public Definition of AlienImage.
-- class PSAlienImage;
---Purpose: Definition of PostScript AlienImage.
class SunRFAlienData;
---Purpose: Private definition of Sun Raster File .rs AlienImage.
class SunRFAlienImage;
---Purpose: Public definition of Sun Raster File .rs AlienImage.
class EuclidAlienData;
---Purpose: Private definition of Euclid .pix AlienImage.
class EuclidAlienImage;
---Purpose: Public definition of Euclid .pix AlienImage.
class SGIRGBAlienData;
---Purpose: Private definition of SGI .rgb AlienImage.
class SGIRGBAlienImage;
---Purpose: Public definition of SGI .rgb AlienImage.
class X11XWDAlienData;
---Purpose: Private definition X11 .xwd AlienImage .
class XAlienImage;
---Purpose: Public definition X11 .xwd AlienImage.
class AidaAlienData;
---Purpose: Private definition of Aida .i AlienImage .
class AidaAlienImage;
---Purpose: Public definition of Aida .i AlienImage.
class MemoryOperations;
---Purpose: A set of function to swap byte in memory, used for
-- comaptibility between LSBFirst and MSBFirst .
private class BMPAlienData;
---Purpose: Private definition of windows .bmp AlienImage.
private class GIFAlienData;
---Purpose: Private definition of windows .gif AlienImage.
class BMPAlienImage;
---Purpose: Public definition of windows .bmp AlienImage.
class GIFAlienImage;
---Purpose: Public definition of windows .gif AlienImage.
---Category: Imported types:
imported GIFLZWDict;
imported BMPHeader;
imported X11XColor ;
imported X11XWDFileHeader ;
imported SGIRGBFileHeader ;
imported SUNRFFileHeader ;
enumeration SUNRFFormat is SUNRF_Old,
SUNRF_Standard,
SUNRF_ByteEncoded,
SUNRF_RGB,
SUNRF_Unknown
end SUNRFFormat ;
---Purpose: Type of code for a SUNRF image.
----------------------------
---Category: Package methods
----------------------------
CreateImage (theFileName : AsciiString from TCollection;
theImage : out Image from Image)
returns Boolean from Standard;
---Purpose:
CreateImage (theFileName : CString from Standard;
theImage : out Image from Image)
returns Boolean from Standard;
---Purpose:
CreateImage (theFile : in out File from OSD;
theImage : out Image from Image)
returns Boolean from Standard;
---Purpose:
LoadImageFile (anImageFile : CString from Standard;
anImage : out Image from Image;
aWidth : out Integer from Standard;
aHeight : out Integer from Standard
) returns Boolean from Standard;
---Purpose: Used by plotter drivers
end AlienImage;

View File

@@ -1,145 +0,0 @@
// Created on: 1998-10-21
// Created by: DCB
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage.hxx>
#include <OSD_Path.hxx>
#include <OSD_File.hxx>
#include <OSD_Protection.hxx>
#include <OSD_Environment.hxx>
#include <Image_Image.hxx>
#include <AlienImage_AlienUserImage.hxx>
#include <AlienImage_XAlienImage.hxx>
#include <AlienImage_SGIRGBAlienImage.hxx>
#include <AlienImage_EuclidAlienImage.hxx>
#include <AlienImage_SunRFAlienImage.hxx>
#include <AlienImage_GIFAlienImage.hxx>
#include <AlienImage_BMPAlienImage.hxx>
//====================================================================
static OSD_Environment& _CSF_DefaultImageFormat() {
static OSD_Environment CSF_DefaultImageFormat("CSF_DefaultImageFormat");
return CSF_DefaultImageFormat;
}
#define CSF_DefaultImageFormat _CSF_DefaultImageFormat()
//====================================================================
Standard_Boolean AlienImage::CreateImage (const TCollection_AsciiString& theFileName,
Handle(Image_Image)& theImage)
{
OSD_File file = OSD_File (OSD_Path (theFileName));
return AlienImage::CreateImage (file, theImage);
}
//====================================================================
Standard_Boolean AlienImage::CreateImage (const Standard_CString theFileName,
Handle(Image_Image)& theImage)
{
OSD_File file = OSD_File (OSD_Path (TCollection_AsciiString (theFileName)));
return AlienImage::CreateImage (file, theImage);
}
//====================================================================
Standard_Boolean AlienImage::CreateImage (OSD_File& theFile,
Handle(Image_Image)& theImage)
{
OSD_Protection theProtection (OSD_R, OSD_R, OSD_R, OSD_R);
OSD_Path thePath;
theFile.Path (thePath);
TCollection_AsciiString theExtension = thePath.Extension();
theExtension.UpperCase ();
Handle(AlienImage_AlienUserImage) theAlienImage;
theFile.Open (OSD_ReadOnly, theProtection);
if (theFile.IsOpen()) {
if (theExtension.IsEqual (".XWD"))
_CreateXWD:
theAlienImage = new AlienImage_XAlienImage ();
else if (theExtension.IsEqual (".RGB"))
_CreateRGB:
theAlienImage = new AlienImage_SGIRGBAlienImage ();
else if (theExtension.IsEqual (".RS"))
_CreateRS:
theAlienImage = new AlienImage_SunRFAlienImage ();
else if (theExtension.IsEqual (".PIX"))
_CreatePIX:
theAlienImage = new AlienImage_EuclidAlienImage ();
else if (theExtension.IsEqual (".GIF"))
_CreateGIF:
theAlienImage = new AlienImage_GIFAlienImage ();
else if (theExtension.IsEqual (".BMP"))
_CreateBMP:
theAlienImage = new AlienImage_BMPAlienImage ();
else if (theExtension.IsEmpty ()) {
// Trye to read $CSF_DefaultImageFormat environment
TCollection_AsciiString theDefExt = CSF_DefaultImageFormat.Value();
theDefExt.Prepend (".");
thePath.SetExtension (theDefExt);
theExtension = theDefExt;
theExtension.UpperCase ();
if (theExtension.IsEqual (".XWD")) goto _CreateXWD;
else if (theExtension.IsEqual (".RGB")) goto _CreateRGB;
else if (theExtension.IsEqual (".RS")) goto _CreateRS;
else if (theExtension.IsEqual (".PIX")) goto _CreatePIX;
else if (theExtension.IsEqual (".GIF")) goto _CreateGIF;
else if (theExtension.IsEqual (".BMP")) goto _CreateBMP;
else return Standard_False;
} else {
return Standard_False;
}
if (!theAlienImage -> Read (theFile)) {
theFile.Close ();
return Standard_False;
}
theImage = theAlienImage -> ToImage ();
theFile.Close ();
return (!theImage.IsNull());
}
return Standard_False;
}
//====================================================================
Standard_Boolean AlienImage::LoadImageFile(const Standard_CString anImageFile,
Handle(Image_Image)& myImage,
Standard_Integer& aWidth,
Standard_Integer& aHeight)
{
// Try to load new image
myImage.Nullify ();
if (AlienImage::CreateImage (anImageFile, myImage)) {
// New image loaded
//_ExitOK:
aWidth = myImage -> Width ();
aHeight = myImage -> Height ();
return Standard_True;
} else {
// Could not load new image
//_ExitError:
myImage.Nullify ();
aWidth = aHeight = 0;
return Standard_False;
}
}

View File

@@ -1,123 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class AidaAlienData from AlienImage inherits AlienImageData from AlienImage
---Version: 0.0
---Level: Public
---Purpose: This class defines an Aida Alien image.
uses
File from OSD,
ColorImage from Image,
PseudoColorImage from Image,
ColorMap from Aspect,
HArray2OfInteger from TColStd,
DitheringMethod from Image,
Image from Image
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable AidaAlienData from AlienImage ;
Clear( me : in out mutable ) ;
---Level: Public
---Purpose: Frees memory allocated by AidaAlienData
---C++: alias ~
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a AidaAlienData object from a file .
-- Returns True if file is a Aida file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a AidaAlienData object to a file .
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Purpose : Converts a AidaAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Purpose : Converts a Image object to a AidaAlienData object.
SetColorImageDitheringMethod( me : in out mutable ;
aMethod : DitheringMethod from Image;
aColorMap : ColorMap from Aspect ) ;
---Level: Public
---Purpose: Set the ImageDitheringMethod and the ColorMap when
-- FromImage is called with a ColorImage .
-- Aida BYTEMAPS file handle only PseudoColorImage .
-- Default value is DM_NearestColor,
-- ColorCubeColorMap( 40, 5,1, 8,6, 3,54 )
AllocData( me : in out mutable ; DX,DY : in Integer from Standard )
is private;
---Level: Internal
---Purpose : Allocate HArray2 to store Image data
Pixel ( me : in immutable ; X,Y : in Integer from Standard )
returns Integer from Standard
raises OutOfRange from Standard is private ;
---Level: Internal
SetPixel( me : in out mutable; X,Y : in Integer from Standard ;
Value : in Integer from Standard )
raises OutOfRange from Standard is private ;
---Level: Internal
FromPseudoColorImage( me : in out mutable;
anImage : in PseudoColorImage from Image )
is private ;
---Level: Internal
---Purpose : convert a Image object to a AidaAlienData object.
FromColorImage( me : in out mutable;
anImage : in ColorImage from Image)
is private ;
---Level: Internal
---Purpose : convert a Image object to a AidaAlienData object.
fields
myDitheringMethod : DitheringMethod from Image is protected ;
myDitheringColorMap : ColorMap from Aspect is protected ;
myColors : ColorMap from Aspect is protected ;
myColorsIsDef : Boolean from Standard is protected ;
-- AidaColors definition
myData : HArray2OfInteger from TColStd ;
myDataIsDef : Boolean from Standard is protected ;
end ;

View File

@@ -1,557 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#define TEST //GG_140699
// Check file extension, must be ".aida".
#include <TCollection_AsciiString.hxx>
#include <Image_Convertor.hxx>
#include <Aspect_GenericColorMap.hxx>
#include <Aspect_ColorCubeColorMap.hxx>
#include <AlienImage_AidaAlienData.ixx>
#include <Aspect_ColorMapEntry.hxx>
# include <stdio.h>
#ifdef TRACE
static int Verbose = 0 ;
#endif
AlienImage_AidaAlienData::AlienImage_AidaAlienData()
{
myDataIsDef = Standard_False ;
myColorsIsDef = Standard_False ;
myDitheringColorMap = new Aspect_ColorCubeColorMap( 40, 5,1, 8,6, 3,54 ) ;
myDitheringMethod = Image_DM_NearestColor ;
}
void AlienImage_AidaAlienData::Clear()
{
myDataIsDef = Standard_False ;
myColorsIsDef = Standard_False ;
}
Standard_Boolean AlienImage_AidaAlienData::Write( OSD_File& file ) const
{ Standard_Integer r,c ;
TCollection_AsciiString out ;
char hexa[3] ;
unsigned char p ;
unsigned long int rc,gc,bc ;
TCollection_AsciiString Space = " " ;
if ( ! myDataIsDef ) return( Standard_False ) ;
if ( ! myColorsIsDef ) return( Standard_False ) ;
out = TCollection_AsciiString( "#BC(" ) +
TCollection_AsciiString( myData->RowLength() ) +
Space +
TCollection_AsciiString( myData->ColLength() ) +
TCollection_AsciiString( " #[\n" ) ;
file.Write( out, out.Length() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
for ( r = myData->LowerRow() ; r <= myData->UpperRow() ; r++ ) {
out = TCollection_AsciiString( "#*" ) ;
for ( c = myData->LowerCol() ; c <= myData->UpperCol() ; c++ ) {
p = ( unsigned char ) myData->Value( r, c ) ;
sprintf( hexa , "%.2x", p ) ;
out += TCollection_AsciiString( hexa ) ;
}
out += TCollection_AsciiString( "\n" ) ;
file.Write( out, out.Length() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
out = TCollection_AsciiString( "](\n" ) ;
file.Write( out, out.Length() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
// write out the color map buffer
for ( c = 1 ; c <= myColors->Size() ; c++ ) {
rc = (long unsigned int )( myColors->Entry(c).Color().Red() * 32767 + 0.5 );
gc = (long unsigned int )( myColors->Entry(c).Color().Green() * 32767 + 0.5 );
bc = (long unsigned int )( myColors->Entry(c).Color().Blue() * 32767 + 0.5 );
out = TCollection_AsciiString( "#[" ) +
TCollection_AsciiString( myColors->Entry(c).Index() ) + Space +
TCollection_AsciiString( Standard_Integer(rc) ) + Space +
TCollection_AsciiString( Standard_Integer(gc) ) + Space +
TCollection_AsciiString( Standard_Integer(bc) ) + Space +
TCollection_AsciiString( "()]\n" ) ;
file.Write( out, out.Length() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
out = TCollection_AsciiString( "))" ) ;
file.Write( out, out.Length() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
return( Standard_True ) ;
}
Standard_Boolean AlienImage_AidaAlienData::Read( OSD_File& file )
{ TCollection_AsciiString tmp, in ;
Standard_Integer loc1, loc2, width, height, i, bblcount, l ,value ;
TCollection_AsciiString HexaSet = "0123456789ABCDEFabcdef" ;
int r,g,b,pixel,status ;
Handle(Aspect_GenericColorMap) GenCmap = NULL ;
#ifdef TEST
OSD_Path path; file.Path(path);
TCollection_AsciiString ext = path.Extension(); ext.LowerCase();
if( ext != ".aida" ) {
TCollection_AsciiString sysname; path.SystemName(sysname);
#ifdef TRACE
cout << " *** AlienImage_AidaAlienData::Read('" << sysname << "'). must have an '.aida' extension" << endl;
#endif
return Standard_False;
}
#endif
Clear() ;
// Extract AidaBYTEMAPS type "#BC"
// Get "#"
do {
file.Read( tmp, 1) ;
} while( !file.Failed() && tmp != TCollection_AsciiString( "#" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get "BC"
file.Read( tmp, 2 ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( tmp != TCollection_AsciiString( "BC" ) ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get "(" Start of AidaBYTEMAPS size definition
do {
file.Read( tmp, 1) ;
} while( !file.Failed() && tmp != TCollection_AsciiString( "(" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get "#" Start of AidaBYTEMAPS Pixel definition
in.Clear() ;
do {
file.Read( tmp, 1) ;
if ( tmp.IsAscii() ) {
in += tmp ;
}
} while( !file.Failed() && tmp != TCollection_AsciiString( "#" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Extract Image size in "Width Height #"
loc1 = 1 ;
if ( ( loc2 = in.Location( 1, ' ', loc1, in.Length() ) ) == 0 ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( ( loc1 ) > ( loc2-1 ) ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
tmp = in.SubString( loc1, loc2-1 ) ;
if ( !tmp.IsIntegerValue() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( ( width = tmp.IntegerValue() ) <= 0 ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
tmp = in.SubString( loc2, in.Length()-1 ) ;
if ( !tmp.IsIntegerValue() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( ( height = tmp.IntegerValue() ) <= 0 ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
#ifdef TRACE
if ( Verbose )
cout << "Width,Height :" << width << "," << height << endl << flush ;
#endif
AllocData( width, height ) ;
// Get "[" start of AidaBYTEMAPS Pixel definition
do {
file.Read( tmp, 1) ;
} while( !file.Failed() && tmp != TCollection_AsciiString( "[" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Extract Pixel lines "#*................."
in.Clear() ;
for ( i = 0 ; i < height ; i++ ) {
// Get "#"
do {
file.Read( tmp, 1) ;
} while( !file.Failed() && tmp != TCollection_AsciiString( "#" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get "*"
file.Read( tmp, 1) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( tmp != TCollection_AsciiString( "*" ) ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get Pixel line
bblcount = 0 ;
in.Clear() ;
while ( bblcount < (2*width) ) {// Two byte per PIXEL
file.Read( tmp, 1) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( tmp.IsAscii() ) {
if ( tmp.FirstLocationInSet( HexaSet, 1, 1 ) ) {
in += tmp ; bblcount++ ;
}
else {
// Get Next line character before end of current line
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
}
}
#ifdef TRACE
if ( Verbose )
cout << "Get one line :\"" << in << "\"\n" << flush ;
#endif
for ( l = 0 ; l < in.Length() ; l += 2 ) {
tmp = in.SubString( l+1, l+2 ) ;
value = ( Standard_Integer )strtol( tmp.ToCString(), NULL, 16 );
SetPixel( l/2 , i, value ) ;
#ifdef TRACE
if ( Verbose > 1 )
cout << "SetPixel(" << l/2 << "," << i << "," << value << ")\n" <<flush;
#endif
}
}
// Get "]" end of Aida image data
do {
file.Read( tmp, 1) ;
} while( !file.Failed() && tmp != TCollection_AsciiString( "]" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get "(" start of Aida colors definition or ")" end of Aida ByteMaps
do {
file.Read( tmp, 1) ;
} while( !file.Failed() &&
tmp != TCollection_AsciiString( "(" ) &&
tmp != TCollection_AsciiString( ")" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( tmp == TCollection_AsciiString( ")" ) ) {
return( Standard_True ) ; // No Color definition ERROR ??
}
// Find Color definition "#[ Red Green Blue ... ]" color is from 0->32767
myColors = GenCmap = new Aspect_GenericColorMap() ;
myColorsIsDef = Standard_True ;
do {
// Get "#" start of a Aida color definition or
// Get ")" end of Aida colors definition
do {
file.Read( tmp, 1) ;
} while( !file.Failed() &&
tmp != TCollection_AsciiString( "#" ) &&
tmp != TCollection_AsciiString( ")" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
if ( tmp == TCollection_AsciiString( "#" ) ) {
// Get "[" start of a Aida color definition
do {
file.Read( tmp, 1) ;
} while( !file.Failed() && tmp != TCollection_AsciiString( "[" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
// Get "]" end of a Aida color definition
in.Clear() ;
do {
file.Read( tmp, 1) ;
if ( tmp.IsAscii() && tmp != TCollection_AsciiString( "]" ) ) {
in += tmp ;
}
} while( !file.Failed() && tmp != TCollection_AsciiString( "]" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
status = sscanf( in.ToCString(), "%d %d %d %d", &pixel,&r,&g,&b ) ;
if ( status == 4 ) {
GenCmap->AddEntry(
Aspect_ColorMapEntry( pixel,
Quantity_Color( r/32767.,g/32767.,b/32767.,
Quantity_TOC_RGB ) ) ) ;
}
#ifdef TRACE
if ( Verbose )
cout << in << endl << flush ;
#endif
}
} while ( !file.Failed() && tmp != TCollection_AsciiString( ")" ) ) ;
if ( file.Failed() ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ; // ERROR
}
return( Standard_True ) ;
}
Handle_Image_Image AlienImage_AidaAlienData::ToImage() const
{ Standard_Integer x,y ;
Handle(Image_PseudoColorImage) aPImage =
new Image_PseudoColorImage( 0, 0,
myData->RowLength(), myData->ColLength(),
myColors );
for( y = 0 ; y < aPImage->Height() ; y++ ) {
for( x = 0 ; x < aPImage->Width() ; x++ ) {
aPImage->SetPixel( aPImage->LowerX()+x,
aPImage->LowerY()+y, Pixel( x, y ) ) ;
}
}
return aPImage ;
}
void AlienImage_AidaAlienData::FromImage( const Handle_Image_Image& anImage )
{ if ( anImage->IsInstance(STANDARD_TYPE(Image_PseudoColorImage)) ) {
Handle(Image_PseudoColorImage) aPImage =
Handle(Image_PseudoColorImage)::DownCast(anImage) ;
FromPseudoColorImage( aPImage ) ;
}
else if ( anImage->IsInstance(STANDARD_TYPE(Image_ColorImage)) ) {
Handle(Image_ColorImage) aCImage =
Handle(Image_ColorImage)::DownCast(anImage) ;
FromColorImage( aCImage ) ;
}
else {
Standard_TypeMismatch_Raise_if( Standard_True,
"Attempt to convert a unknown Image_Image type to a AidaAlienData");
}
}
void AlienImage_AidaAlienData::SetColorImageDitheringMethod(
const Image_DitheringMethod aMethod ,
const Handle(Aspect_ColorMap)& aColorMap )
{ myDitheringMethod = aMethod ; myDitheringColorMap = aColorMap ; }
//------------------------------------------------------------------------------
// Private Method
//------------------------------------------------------------------------------
void AlienImage_AidaAlienData::FromPseudoColorImage(
const Handle_Image_PseudoColorImage& anImage)
{ Standard_Integer x,y ;
AllocData( anImage->Width(), anImage->Height() ) ;
myColors = anImage->ColorMap() ;
myColorsIsDef = Standard_True ;
for ( y = 0 ; y < anImage->Height() ; y++ ) {
for ( x = 0 ; x < anImage->Width() ; x++ ) {
SetPixel( x,
y,
anImage->Pixel( anImage->LowerX()+x,
anImage->LowerY()+y ).Value() ) ;
}
}
}
void AlienImage_AidaAlienData::FromColorImage(
const Handle_Image_ColorImage& anImage)
{ Image_Convertor Convertor ;
Handle(Image_PseudoColorImage) aPImage =
new Image_PseudoColorImage( anImage->LowerX(), anImage->LowerY(),
anImage->Width(), anImage->Height(),
myDitheringColorMap ) ;
Convertor.SetDitheringMethod( myDitheringMethod ) ;
aPImage = Convertor.Convert( anImage, myDitheringColorMap ) ;
FromPseudoColorImage( aPImage ) ;
}
void AlienImage_AidaAlienData::AllocData(
const Standard_Integer dx,
const Standard_Integer dy )
{
myData = new TColStd_HArray2OfInteger( 0, dy-1 , 0, dx-1 ) ;
myDataIsDef = Standard_True ;
}
void AlienImage_AidaAlienData::SetPixel(
const Standard_Integer x,
const Standard_Integer y,
const Standard_Integer value )
{
myData->SetValue( y, x, value ) ;
}
Standard_Integer AlienImage_AidaAlienData::Pixel(
const Standard_Integer x, const Standard_Integer y ) const
{ return myData->Value( y, x ) ; }

View File

@@ -1,81 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: 02-06-98 : FMN ; Suppression appel Clear (deja fait dans ALienData)
class AidaAlienImage from AlienImage inherits AlienUserImage from AlienImage
---Version: 0.0
---Purpose: This class defines an Aida Alien image ( BYTEMAPS ).
---Keywords:
---Warning:
---References:
uses
File from OSD,
ColorMap from Aspect,
Image from Image,
DitheringMethod from Image,
AidaAlienData from AlienImage
is
Create returns mutable AidaAlienImage from AlienImage;
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by AidaAlienImage
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : convert a AidaAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : convert a Image object to a AidaAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a AidaAlienImage object from a file .
-- Returns True if file is a Aida file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a AidaAlienImage object to a file .
SetColorImageDitheringMethod( me : in out mutable ;
aMethod : DitheringMethod from Image;
aColorMap : ColorMap from Aspect ) ;
---Level: Public
---Purpose: Set the ImageDitheringMethod and the ColorMap when
-- FromImage is called with a ColorImage .
-- Aida BYTEMAPS file handle only PseudoColorImage .
-- Default value is DM_NearestColor,
-- ColorCubeColorMap( 40, 5,1, 8,6, 3,54 )
fields
myData : AidaAlienData from AlienImage;
end ;

View File

@@ -1,59 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <stdio.h>
#include <AlienImage_XAlienImage.hxx>
#include <OSD_Protection.hxx>
#include <OSD_File.hxx>
#include <AlienImage_AidaAlienImage.ixx>
AlienImage_AidaAlienImage::AlienImage_AidaAlienImage()
{ // il faut faire un new si mydata est du type HANDLE
myData = new AlienImage_AidaAlienData() ;
}
void AlienImage_AidaAlienImage::Clear()
{ myData->Clear() ; }
Standard_Boolean AlienImage_AidaAlienImage::Write( OSD_File& file ) const
{ return( myData->Write( file ) ) ; }
Standard_Boolean AlienImage_AidaAlienImage::Read( OSD_File& file )
{ return( myData->Read( file ) ) ; }
Handle(Image_Image) AlienImage_AidaAlienImage::ToImage() const
{ return( myData->ToImage() ) ; }
void AlienImage_AidaAlienImage::FromImage( const Handle(Image_Image)& anImage )
{ myData->FromImage( anImage ) ; }
void AlienImage_AidaAlienImage::SetColorImageDitheringMethod(
const Image_DitheringMethod aMethod ,
const Handle(Aspect_ColorMap)& aColorMap )
{ myData->SetColorImageDitheringMethod( aMethod, aColorMap ) ; }

View File

@@ -1,60 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL,JLF
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
deferred class AlienImage from AlienImage inherits TShared from MMgt
---Purpose: This class defines an Alien image.
-- Alien Image is X11 .xwd image or SGI .rgb image for example
uses
File from OSD,
Image from Image
raises
TypeMismatch from Standard
is
Initialize ;
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard is deferred;
---Level: Public
---Purpose: Reads content of a AlienImage object from a file .
-- Returns True if file is a XWD file .
Write( me : in immutable ; afile : in out File from OSD )
returns Boolean from Standard is deferred ;
---Level: Public
---Purpose: Writes content of a AlienImage object to a file .
ToImage ( me : in immutable )
returns mutable Image from Image
raises TypeMismatch from Standard is deferred ;
---Level: Public
---Purpose : Converts a AlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard is deferred ;
---Level: Public
---Purpose : Converts a Image object to a AlienImage object.
end AlienImage;

View File

@@ -1,57 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL,JLF
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: DCB (20-OCT-98)
-- Define Name()/SetName() as deferred.
deferred class AlienImageData from AlienImage inherits AlienImage
---Version: 0.0
---Purpose: This class defines an Alien image.
-- Alien Image is X11 . xwd image or SGI .rgb image for examples
---Keywords:
---Warning:
---References:
uses
AsciiString from TCollection
is
Initialize ;
SetName( me : in out mutable;
aName : in AsciiString from TCollection)
is virtual;
---Level: Public
---Purpose: Set Image name .
Name( me : in immutable ) returns AsciiString from TCollection
is virtual;
---C++: return const &
---Level: Public
---Purpose: get Image name .
fields
myName: AsciiString from TCollection is protected;
end AlienImageData;

View File

@@ -1,81 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL,JLF
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: DCB (20-OCT-98)
-- Define ToImage()/FromName() as deferred.
deferred class AlienUserImage from AlienImage inherits AlienImage
---Version: 0.0
---Purpose: This class defines an Alien user image.
-- Alien Image is X11 .xwd image or SGI .rgb image for examples
---Keywords:
---Warning:
---References:
uses
Image from Image,
File from OSD
raises
TypeMismatch from Standard
is
Initialize ;
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard is deferred;
---Level: Public
---Purpose: Read content of a UserAlienImage object from a file .
-- Returns True if sucess .
Read ( me : in out mutable ; afile : in CString from Standard )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a UserAlienImage object from a file .
-- Returns True if file is a AlienImage file .
Write ( me : in immutable ; afile : in out File from OSD )
returns Boolean from Standard is deferred ;
---Level: Public
---Purpose: Write content of a UserAlienImage object to a file .
Write ( me : in immutable ; afile : in CString from Standard )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a UserAlienImage object to a file .
ToImage ( me : in immutable )
returns mutable Image from Image
raises TypeMismatch from Standard
is deferred;
---Level: Public
---Purpose : convert a AidaAlienData object to a Image object.
FromImage ( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard
is deferred;
---Level: Public
---Purpose : convert a Image object to a AidaAlienData object.
end AlienUserImage;

View File

@@ -1,93 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <OSD_Process.hxx>
#include <OSD_Protection.hxx>
#include <AlienImage_XAlienImage.hxx>
#include <AlienImage_AlienUserImage.ixx>
#include <OSD_File.hxx>
#include <OSD_Path.hxx>
AlienImage_AlienUserImage::AlienImage_AlienUserImage()
{
#ifdef TRACE
cout << "AlienImage_AlienUserImage constructor \n" ;
#endif
}
#ifdef IMPLEMENTED
AlienImage_AlienUserImage::AlienImage_AlienUserImage(
const Standard_CString afile,
Standard_Boolean& Success )
{
#ifdef TRACE
cout << "AlienImage_AlienUserImage constructor \n" ;
#endif
Success = Read( afile ) ;
}
AlienImage_AlienUserImage::AlienImage_AlienUserImage(
const Handle(Image_Image)& anImage)
{
#ifdef TRACE
cout << "AlienImage_AlienUserImage constructor \n" ;
#endif
FromImage( anImage ) ;
}
#endif
Standard_Boolean AlienImage_AlienUserImage::Read( const Standard_CString file )
{ OSD_File File ;
OSD_Protection Protection ;
OSD_Path Path;
Standard_Boolean Ret ;
Protection.SetValues( OSD_R, OSD_R, OSD_R, OSD_R ) ;
Path = OSD_Path( TCollection_AsciiString( file ),OSD_Default);
File.SetPath ( Path ); // Instanciate
File.Open ( OSD_ReadOnly, Protection ) ;
Ret = Read( File ) ;
File.Close() ;
return( Ret ) ;
}
Standard_Boolean AlienImage_AlienUserImage::Write(
const Standard_CString file)const
{ OSD_File File ;
OSD_Protection Protection ;
OSD_Path Path;
Standard_Boolean Ret ;
Protection.SetValues( OSD_RW, OSD_RW, OSD_RW, OSD_RW ) ;
Path = OSD_Path( TCollection_AsciiString( file ),OSD_Default);
File.SetPath ( Path ); // Instanciate
File.Build ( OSD_WriteOnly, Protection ) ;
Ret = Write( File ) ;
File.Close() ;
return( Ret ) ;
}

View File

@@ -1,87 +0,0 @@
-- Created on: 1998-10-20
-- Created by: DCB
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
private class BMPAlienData from AlienImage inherits AlienImageData from AlienImage
uses
File from OSD,
GenericColorMap from Aspect,
PseudoColorImage from Image,
ColorImage from Image,
Image from Image
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable BMPAlienData from AlienImage ;
Clear( me : in out mutable );
---Level: Public
---Purpose: Frees memory allocated by BMPAlienData
---C++: alias ~
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard;
---Level: Public
---Purpose: Read content of a BMPAlienData object from a file
-- Returns True if file is a BMP file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard;
---Level: Public
---Purpose: Write content of a BMPAlienData object to a file
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a BMPAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a Image object to a BMPAlienData object.
------------------------------------------------------
--- Private methods
------------------------------------------------------
FromPseudoColorImage (me : in out mutable;
anImage : in PseudoColorImage from Image )
is private;
---Level: Internal
---Purpose : convert a Image object to a GIFAlienData object.
FromColorImage (me : in out mutable;
anImage : in ColorImage from Image)
is private;
---Level: Internal
---Purpose : convert a Image object to a GIFAlienData object.
fields
myColorMap : GenericColorMap from Aspect;
myData : Address from Standard; --BYTE* or DWORD*
myWidth : Integer from Standard;
myHeight : Integer from Standard;
end;

View File

@@ -1,589 +0,0 @@
// Created by: DCB
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
// Notes:
// Read()/Write() code is taken from ZOV's sources from Xw package.
// include windows.h first to ensure that it is loaded completely
#ifdef WNT
#include <windows.h>
#endif
#include <AlienImage_BMPAlienData.ixx>
#include <AlienImage_BMPHeader.hxx>
#include <Aspect_ColorMap.hxx>
#include <Aspect_ColorMapEntry.hxx>
#include <Quantity_Color.hxx>
#include <Image_PseudoColorImage.hxx>
#include <Image_ColorImage.hxx>
#include <OSD_FromWhere.hxx>
#include <Standard.hxx>
static unsigned long __swaptest = 1;
WORD static _TestSwapWORD (WORD __w)
{
return LOW_VAL_AT_LOW_ADDR ? __w:
((__w&0xFF) << 8) | ((__w&0xFF00) >> 8);
}
DWORD static _TestSwapDWORD (DWORD __dw)
{
return LOW_VAL_AT_LOW_ADDR ? __dw:
((__dw&0x000000FF) << 24) | ((__dw&0x0000FF00) << 8)
| ((__dw&0xFF0000) >> 8) | ((__dw&0xFF000000) >> 24);
}
#define STGMGR_ALLOC(size) Standard::Allocate(size)
#define STGMGR_FREE(buf,size) Standard::Free((void*&)buf)
#define BPIXEL ((BYTE *) myData)
#define DWPIXEL ((DWORD*) myData)
//================================================================
AlienImage_BMPAlienData::AlienImage_BMPAlienData ()
: AlienImage_AlienImageData ()
{
myData = NULL;
myWidth = 0;
myHeight = 0;
myColorMap.Nullify ();
}
//================================================================
void AlienImage_BMPAlienData::Clear ()
{
if (myData) {
STGMGR_FREE (myData, (!myColorMap.IsNull() ? myWidth*myHeight :
myWidth*myHeight*4));
myData = NULL;
}
myWidth = 0;
myHeight = 0;
myColorMap.Nullify ();
}
//================================================================
Standard_Boolean AlienImage_BMPAlienData::Read (OSD_File& file)
{
BYTE *pData = NULL, *pbData=NULL; // pointer to bitmap pixels
BYTE *ptrByte;
int i, isize, ncolors, bytes_per_line, x, y, width, height;
DWORD dwRMask, dwGMask, dwBMask, dwSize;
int nRMult, nGMult, nBMult;
int isInsideOut, hasMask, nBitCount;
int iCompression, isOS2Format, hasColormap;
int nBytes, iDataSize;
char bmpSign[2];
AlienImage_BMPHeader bmfh; // Standard BMP file header
BITMAPINFOHEADER bmih; // Windows BMP header
BITMAPCOREHEADER bmch; // OS/2 BMP header
Standard_Address lpVoid;
Quantity_Color color;
Standard_Real r, g, b;
Aspect_ColorMapEntry entry;
RGBQUAD* pColors256 = (RGBQUAD*) STGMGR_ALLOC (sizeof(RGBQUAD)*256);
// Check 'BM' signature
file.Seek (0, OSD_FromBeginning);
lpVoid = Standard_Address(&bmpSign[0]);
file.Read ((void*&)lpVoid, 2, nBytes);
if (file.Failed () || strncmp (bmpSign, "BM", 2) || nBytes != 2) {
// cout << "AlienImage_BMPAlienData::Read() : 'BM' signature not found."
// << endl << flush;
goto _ExitReadError;
}
lpVoid = Standard_Address(&bmfh);
file.Read ((void*&)lpVoid, sizeof(AlienImage_BMPHeader), nBytes);
if (file.Failed () || nBytes != sizeof(AlienImage_BMPHeader)) {
cout << "AlienImage_BMPAlienData::Read() : Reading AlienImage_BMPHeader."
<< endl << flush;
goto _ExitReadError;
}
lpVoid = Standard_Address (&dwSize);
file.Read ((void*&)lpVoid, sizeof (DWORD), nBytes);
if (file.Failed() || nBytes != sizeof (DWORD)) {
cout << "AlienImage_BMPAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
file.Seek (-(int)sizeof(DWORD), OSD_FromHere);
isOS2Format = _TestSwapDWORD(dwSize) == sizeof (BITMAPCOREHEADER);
if (isOS2Format) {
lpVoid = Standard_Address(&bmch);
file.Read ((void*&)lpVoid, sizeof(BITMAPCOREHEADER), nBytes);
if (file.Failed() || nBytes != sizeof(BITMAPCOREHEADER)) {
cout << "AlienImage_BMPAlienData::Read() : Reading BITMAPCOREHEADER."
<< endl << flush;
goto _ExitReadError;
}
} else {
lpVoid = Standard_Address(&bmih);
file.Read ((void*&)lpVoid, sizeof(BITMAPINFOHEADER), nBytes);
if (file.Failed() || nBytes != sizeof(BITMAPINFOHEADER)) {
cout << "AlienImage_BMPAlienData::Read() : Reading BITMAPINFOHEADER."
<< endl << flush;
goto _ExitReadError;
}
}
nBitCount = _TestSwapWORD (isOS2Format ? bmch.bcBitCount: bmih.biBitCount);
if ((nBitCount != 1 && nBitCount != 4 && nBitCount != 8 &&
nBitCount != 16 && nBitCount != 24 && nBitCount != 32) ||
isOS2Format && (nBitCount == 16 || nBitCount == 32)) {
cout << "AlienImage_BMPAlienData::Read() : Bad <nBitCount> value :"
<< nBitCount << " " << isOS2Format << endl << flush;
goto _ExitReadError;
}
iCompression = isOS2Format ? BI_RGB: _TestSwapDWORD (bmih.biCompression);
hasColormap = nBitCount <= 8;
hasMask = iCompression == BI_BITFIELDS;
ncolors = hasColormap ? 1 << nBitCount: 0;
width = isOS2Format ? _TestSwapWORD (bmch.bcWidth)
: _TestSwapDWORD (bmih.biWidth);
height = isOS2Format ? _TestSwapWORD (bmch.bcHeight)
: _TestSwapDWORD (bmih.biHeight);
isInsideOut = !isOS2Format && height < 0;
height = isInsideOut ? -height: height;
bytes_per_line = width * nBitCount;
bytes_per_line = (bytes_per_line>>3) + (bytes_per_line&0x7 ? 1: 0);
bytes_per_line += (bytes_per_line&0x3)? (4-(bytes_per_line&0x3)): 0;
myWidth = width;
myHeight = height;
if (hasColormap) {
// Retreive array of colors (as RGBQUAD sequence).
// Note, that there can be less then ncolors colors.
isize = ncolors * sizeof (RGBQUAD);
file.Read ((void*&)pColors256, isize, nBytes);
if (file.Failed() || nBytes != isize) {
cout << "AlienImage_BMPAlienData::Read() : Reading ColorMap."
<< endl << flush;
goto _ExitReadError;
}
// Build colormap
myColorMap = new Aspect_GenericColorMap ();
for (i=0; i<ncolors; i++) {
r = ((float)pColors256[i].rgbRed / 255.);
g = ((float)pColors256[i].rgbGreen / 255.);
b = ((float)pColors256[i].rgbBlue / 255.);
color.SetValues (r, g, b, Quantity_TOC_RGB);
entry.SetValue (i, color);
myColorMap -> AddEntry (entry);
}
}
if (hasMask) {
PDWORD pdw;
// Retrieve three DWORD's that contain the masks for R, G and B respectively
file.Read ((void*&)(pdw = &dwRMask), sizeof (DWORD), nBytes);
if (file.Failed() || nBytes != sizeof(DWORD)) {
cout << "AlienImage_BMPAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
file.Read ((void*&)(pdw = &dwGMask), sizeof (DWORD), nBytes);
if (file.Failed() || nBytes != sizeof(DWORD)) {
cout << "AlienImage_BMPAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
file.Read ((void*&)(pdw = &dwBMask), sizeof (DWORD), nBytes);
if (file.Failed() || nBytes != sizeof(DWORD)) {
cout << "AlienImage_BMPAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
if (hasColormap || !dwRMask || !dwGMask || !dwBMask) {
cout << "AlienImage_BMPAlienData::Read() : BAD image colormap." << endl << flush;
goto _ExitReadError;
}
dwRMask = _TestSwapDWORD (dwRMask);
dwGMask = _TestSwapDWORD (dwGMask);
dwBMask = _TestSwapDWORD (dwBMask);
nRMult = nGMult = nBMult = 0;
for (i=dwRMask; (i&1)^1; i >>= 1)
nRMult++;
for (i=dwGMask; (i&1)^1; i >>= 1)
nGMult++;
for (i=dwBMask; (i&1)^1; i >>= 1)
nBMult++;
} else {
dwBMask = 0x000000ff, dwGMask = 0x0000ff00, dwRMask = 0x00ff0000,
nBMult = 0, nGMult = 8, nRMult = 16;
}
// Allocate the pixel buffer and load raw data from file
i = _TestSwapDWORD (bmfh.bfOffBits);
iDataSize = _TestSwapDWORD (bmfh.bfSize) - i;
pData = (BYTE *) STGMGR_ALLOC (iDataSize);
pbData = pData;
file.Seek (i, OSD_FromBeginning);
file.Read ((void*&)pData, iDataSize, nBytes);
if (file.Failed () || nBytes != iDataSize) {
cout << "AlienImage_BMPAlienData::Read() : Image data."
<< endl << flush;
goto _ExitReadError;
}
if (iCompression == BI_RLE4 || iCompression == BI_RLE8) {
pbData = (BYTE*) STGMGR_ALLOC (width*height);
// Note, that it is possible that "spots" could appear
// after decompressing the data encoded using RLE algorith.
// The method assumes that the image is drawn to an already
// defined background. That's why I have to fill in these
// probable spots with some color (I have chosen 0-indexed one).
memset (pbData, 0, iDataSize);
// Decompress the data to array of 8-bit color indices
x = 0;
y = 0;
ptrByte = pData;
for (;;) {
BYTE bPixCount = *ptrByte++;
BYTE bCode, bColor;
if (bPixCount) {
bColor = *ptrByte++;
//fprintf (stderr, "[%02x S]", (int)bPixCount);
if (iCompression == BI_RLE8) {
while (bPixCount--)
pbData [width*y + x++] = bColor;
} else {
BYTE bColor0 = (bColor & 0xf0) >> 4;
BYTE bColor1 = bColor & 0x0f;
i = 0;
while (bPixCount--)
pbData [width*y + x++] = i++ & 1 ? bColor1: bColor0;
}
continue;
}
// Zero code has been reached.
// Do the command specified in the second byte.
bCode = *ptrByte++;
if (!bCode) { // EOL
x = 0, y++; //,fprintf (stderr, "\r\n");
} else if (bCode == 1) { // EOF
break;
} else if (bCode == 2) { // Delta
x += (unsigned) *ptrByte++;
y += (unsigned) *ptrByte++;
//fprintf (stderr, "[POS=%d,%d]", x, y);
} else { // Absolute mode
bPixCount = bCode;
//fprintf (stderr, "[%02x D]", (int)bPixCount);
if (iCompression == BI_RLE8) {
while (bPixCount--)
pbData [width*y + x++] = *ptrByte++;
} else {
i = 0;
while (bPixCount--)
pbData [width*y + x++] = i++ & 1 ? *ptrByte & 0x0f
: (*ptrByte++ & 0xf0) >> 4;
}
// each run must aligned on a word boundary
if (iCompression == BI_RLE8 && (bCode & 1) ||
iCompression == BI_RLE4 && (bCode & 3))
ptrByte ++;
}
}
bytes_per_line = width;
nBitCount = 8;
STGMGR_FREE (pData, iDataSize);
iDataSize = width*height;
}
// Data isn't comressed. Can just use the raw data
// Alloc image data (pidata) and fill in the buffer with RGBQUAD's
isize = width*height;
myData = STGMGR_ALLOC (!myColorMap.IsNull() ? myWidth*myHeight : myWidth*myHeight*4);
x = 0;
y = isInsideOut? 0: height-1;
for (i = 0; i < isize; i++) {
DWORD dwValue=0;
BYTE* pbLine = pbData + y*bytes_per_line;
switch (nBitCount) {
case 32:
dwValue = *(((DWORD *) pbLine) + x); break; // next double word value
case 16:
dwValue = *(((WORD *) pbLine) + x); break; // next word
case 8:
dwValue = *(((BYTE *) pbLine) + x); break; // next byte
case 24: {
BYTE* pbTripple = pbLine + x+(x<<1);
dwValue = *pbTripple + (*(pbTripple +1) <<8) + (*(pbTripple +2) <<16);
} break;
case 4:
dwValue = (x&1) ? *(pbLine+(x>>1))&0x0f: (*(pbLine+(x>>1))&0xf0) >> 4; break;
case 1: {
int iBit = 7 - (x&7);
dwValue = (*(pbLine+(x>>3)) & (1 <<iBit)) >>iBit;
} break; // next bit
}
if (hasColormap) {
BPIXEL [i] = (BYTE) dwValue; // put index in colormap
} else {
DWPIXEL[i] = (DWORD) dwValue; // put RGB
}
if (++x == width) {
x = 0;
y += isInsideOut? 1: -1;
}
}
STGMGR_FREE (pColors256, sizeof(RGBQUAD)*256);
STGMGR_FREE (pbData, iDataSize);
return Standard_True;
_ExitReadError:
// cout << "AlienImage_BMPAlienData::Read() : Read file error." << endl << flush;
STGMGR_FREE (pColors256, sizeof(RGBQUAD)*256);
if (pbData) STGMGR_FREE (pbData, iDataSize);
Clear ();
return Standard_False;
}
//================================================================
Standard_Boolean AlienImage_BMPAlienData::Write (OSD_File& file) const
{
AlienImage_BMPHeader bfh;
BITMAPINFOHEADER bih;
int isize, x, y;
BYTE *pbData = NULL, *pbCell = NULL;
WORD sign = _TestSwapWORD(0x4D42); // BMP file signature: SWAP('MB')
DWORD dwPixel;
RGBQUAD* prgbColor = (RGBQUAD*)&dwPixel;
Quantity_Color color;
Standard_Real r, g, b;
if (myData == NULL || myWidth == 0 || myHeight == 0 )
return Standard_False;
// Get the size of array of pixels
isize = myWidth*3; // actual size of data in each scan line
isize += (isize & 3 ? 4 - (isize & 3): 0); // plus pad size
isize *= myHeight;
pbData = (BYTE*) STGMGR_ALLOC (isize);
// Build and write File Header.
bfh.bfSize = _TestSwapDWORD(2+sizeof (AlienImage_BMPHeader) +
sizeof (BITMAPINFOHEADER) +
sizeof (RGBQUAD)*0 +
isize);
bfh.bfReserved = 0;
bfh.bfOffBits = _TestSwapDWORD(2+sizeof (AlienImage_BMPHeader) +
sizeof (BITMAPINFOHEADER) +
sizeof (RGBQUAD)*0);
// Write file signature
file.Write (&sign, 2);
if (file.Failed ())
goto _ExitWriteError;
// Write file header
file.Write (&bfh, sizeof (bfh));
if (file.Failed ())
goto _ExitWriteError;
// Build and write Info Header.
bih.biSize = _TestSwapDWORD(sizeof (BITMAPINFOHEADER));
bih.biWidth = _TestSwapDWORD(myWidth );
bih.biHeight = _TestSwapDWORD(myHeight);
bih.biPlanes = _TestSwapWORD (1);
bih.biBitCount = _TestSwapWORD (24); // 8 bits per each of R,G and B value
bih.biCompression = 0; // BI_RGB
bih.biSizeImage = 0; // can be zero for BI_RGB
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0; // all colors used
bih.biClrImportant = 0; // all colors imortant
file.Write (&bih, sizeof (bih));
if (file.Failed ())
goto _ExitWriteError;
// Fill in array of pixels and write out the buffer.
pbCell = pbData;
for (y = myHeight-1; y >= 0; y--) {
for (x = 0; x < myWidth; x++) {
if (!myColorMap.IsNull ()) {
color = myColorMap -> FindEntry (BPIXEL[y*myWidth + x]).Color ();
color.Values (r, g, b, Quantity_TOC_RGB);
*pbCell++ = (BYTE)(b*255.);
*pbCell++ = (BYTE)(g*255.);
*pbCell++ = (BYTE)(r*255.);
} else {
dwPixel = _TestSwapDWORD (DWPIXEL[y*myWidth + x]);
*pbCell++ = prgbColor -> rgbBlue;
*pbCell++ = prgbColor -> rgbGreen;
*pbCell++ = prgbColor -> rgbRed;
}
}
x *= 3;
// Pad each scan line with zeroes to end on a LONG data-type boundary
while (x++ & 0x03) // i.e. until 4 devides x
*pbCell++ = 0;
}
file.Write (pbData, isize);
if (file.Failed ())
goto _ExitWriteError;
STGMGR_FREE (pbData, isize);
return Standard_True;
_ExitWriteError:
cout << "AlienImage_BMPAlienData::Write() : Write file error." << endl << flush;
STGMGR_FREE (pbData, isize);
return Standard_False;
}
//================================================================
Handle_Image_Image AlienImage_BMPAlienData::ToImage () const
{
Standard_Integer x, y, LowX, LowY;
Handle(Image_Image) theImage;
if (!myColorMap.IsNull()) {
Aspect_IndexPixel iPixel;
theImage = new Image_PseudoColorImage (0, 0, myWidth, myHeight, myColorMap);
LowX = theImage -> LowerX ();
LowY = theImage -> LowerY ();
for (y = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
iPixel.SetValue (BPIXEL[y*myWidth + x]);
theImage -> SetPixel (LowX + x, LowY + y, iPixel);
}
}
} else {
DWORD dwPixel;
RGBQUAD* pRgb = (RGBQUAD*)&dwPixel;
Standard_Real r, g, b;
Quantity_Color color;
Aspect_ColorPixel cPixel;
theImage = new Image_ColorImage (0, 0, myWidth, myHeight);
LowX = theImage -> LowerX ();
LowY = theImage -> LowerY ();
for (y = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
dwPixel = _TestSwapDWORD (DWPIXEL[y*myWidth + x]);
r = ((float)pRgb -> rgbRed / 255.);
g = ((float)pRgb -> rgbGreen / 255.);
b = ((float)pRgb -> rgbBlue / 255.);
color.SetValues (r, g, b, Quantity_TOC_RGB);
cPixel.SetValue (color);
theImage -> SetPixel (LowX + x, LowY + y, cPixel);
}
}
}
return theImage;
}
//================================================================
void AlienImage_BMPAlienData::FromImage (const Handle_Image_Image& anImage)
{
if (anImage -> Type() == Image_TOI_PseudoColorImage) {
// Build from PseudoColorImage
Handle(Image_PseudoColorImage) aPImage =
Handle(Image_PseudoColorImage)::DownCast(anImage);
FromPseudoColorImage (aPImage);
} else if (anImage -> Type() == Image_TOI_ColorImage) {
// Build from ColorImage
Handle(Image_ColorImage) aCImage =
Handle(Image_ColorImage)::DownCast(anImage);
FromColorImage (aCImage);
} else {
// Unknown type of image
Standard_TypeMismatch_Raise_if (Standard_True,
"Attempt to convert a unknown Image_Image type to a BMPAlienData");
}
}
//================================================================
void AlienImage_BMPAlienData::FromPseudoColorImage (
const Handle(Image_PseudoColorImage)& anImage)
{
int width = anImage -> Width ();
int height = anImage -> Height ();
int x, y, LowX = anImage -> LowerX(), LowY = anImage -> LowerY();
Aspect_IndexPixel iPixel;
BYTE index;
if (width*height > 0) {
Handle(Aspect_ColorMap) aColorMap = anImage -> ColorMap ();
// Clear old data if any
Clear ();
// Fill colormap
myColorMap = new Aspect_GenericColorMap ();
for (int i = 1; i <= aColorMap -> Size (); i++)
myColorMap -> AddEntry (aColorMap -> Entry (i));
// Fill image's data
myWidth = width;
myHeight = height;
myData = STGMGR_ALLOC (myWidth*myHeight);
for (y = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
iPixel = anImage -> Pixel (LowX + x, LowY + y);
index = aColorMap -> FindEntry (iPixel.Value ()).Index ();
BPIXEL[y*myWidth + x] = index;
}
}
}
}
//================================================================
void AlienImage_BMPAlienData::FromColorImage (
const Handle(Image_ColorImage)& anImage)
{
int width = anImage -> Width ();
int height = anImage -> Height ();
int x, y, LowX = anImage -> LowerX(), LowY = anImage -> LowerY();
Standard_Real r, g, b;
Quantity_Color color;
RGBQUAD rgbColor;
DWORD* pdwPixel = (DWORD*)&rgbColor;
if (width*height > 0) {
// Clear old data if any
Clear ();
// Fill image's data
myWidth = width;
myHeight = height;
myData = STGMGR_ALLOC (myWidth*myHeight*4);
for (y = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
color = anImage -> PixelColor (LowX + x, LowY + y);
color.Values (r, g, b, Quantity_TOC_RGB);
rgbColor.rgbRed = (int)(r*255.);
rgbColor.rgbGreen = (int)(g*255.);
rgbColor.rgbBlue = (int)(b*255.);
rgbColor.rgbReserved = 0;
DWPIXEL[y*myWidth + x] = _TestSwapDWORD (*pdwPixel);
}
}
}
}

View File

@@ -1,73 +0,0 @@
-- Created on: 1998-10-20
-- Created by: DCB
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class BMPAlienImage from AlienImage inherits AlienUserImage from AlienImage
uses
BMPAlienData from AlienImage,
File from OSD,
AsciiString from TCollection,
Image from Image
is
Create
returns mutable BMPAlienImage from AlienImage;
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by BMPAlienImage
---C++: alias ~
SetName( me : in out mutable;
aName : in AsciiString from TCollection) ;
---Level: Public
---Purpose: Set Image name .
Name( me : in immutable ) returns AsciiString from TCollection ;
---C++: return const &
---Level: Public
---Purpose: get Image name .
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : convert a BMPAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : convert a Image object to a BMPAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a BMPAlienImage object from a file .
-- Returns True if file is a BMP file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a BMPAlienImage object to a file .
fields
myData : BMPAlienData from AlienImage;
end;

View File

@@ -1,70 +0,0 @@
// Created by: DCB
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_BMPAlienImage.ixx>
//================================================================
AlienImage_BMPAlienImage::AlienImage_BMPAlienImage ()
{
myData = new AlienImage_BMPAlienData() ;
}
//================================================================
void AlienImage_BMPAlienImage::Clear ()
{
myData->Clear();
}
//================================================================
void AlienImage_BMPAlienImage::SetName (const TCollection_AsciiString& aName)
{
myData->SetName (aName);
}
//================================================================
const TCollection_AsciiString& AlienImage_BMPAlienImage::Name () const
{
return (myData->Name());
}
//================================================================
Standard_Boolean AlienImage_BMPAlienImage::Write (OSD_File& file) const
{
return myData->Write(file);
}
//================================================================
Standard_Boolean AlienImage_BMPAlienImage::Read (OSD_File& file)
{
return myData->Read(file);
}
//================================================================
Handle_Image_Image AlienImage_BMPAlienImage::ToImage () const
{
return myData->ToImage();
}
//================================================================
void AlienImage_BMPAlienImage::FromImage (const Handle_Image_Image& anImage)
{
myData->FromImage(anImage);
}

View File

@@ -1,90 +0,0 @@
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//============================================================================
//==== Titre: AlienImage_BMPHeader.hxx
//============================================================================
#ifndef _AlienImage_BMPHeader_HeaderFile
#define _AlienImage_BMPHeader_HeaderFile
//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
#ifdef WNT
# include <windows.h>
#else
typedef unsigned int DWORD; // 32-bit signed
typedef unsigned int* PDWORD;
typedef int LONG; // 32-bit unsigned
typedef unsigned short WORD; // 16-bit unsigned
typedef unsigned char BYTE; // 8-bit unsigned
#endif // WNT
typedef struct {
// WORD bfType;
DWORD bfSize;
DWORD bfReserved;
DWORD bfOffBits;
} AlienImage_BMPHeader;
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_BMPHeader);
//============================================================================
#ifndef WNT
typedef struct tagBITMAPINFOHEADER {
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
typedef struct tagBITMAPCOREHEADER {
DWORD bcSize;
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes; // 1
WORD bcBitCount; // 1,4,8 or 24
} BITMAPCOREHEADER;
// constants for the biCompression field
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#define BI_BITFIELDS 3
typedef struct tagRGBQUAD {
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved;
} RGBQUAD;
#endif // WNT
#define LOW_VAL_AT_LOW_ADDR (*(char*)&__swaptest)
#endif // _AlienImage_BMPHeader_HeaderFile

View File

@@ -1,97 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class EuclidAlienData from AlienImage inherits AlienImageData from AlienImage
---Version: 0.0
---Level: Public
---Purpose: This class defines an Euclid .PIX Alien image.
---Keywords:
---Warning:
---References:
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
HArray2OfInteger from TColStd
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable EuclidAlienData from AlienImage ;
Clear( me : in out mutable ) ;
---Level: Public
---Purpose: Frees memory allocated by EuclidAlienData
---C++: alias ~
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a EuclidAlienData object from a file .
-- Returns True if file is a XWD file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a EuclidAlienData object to a file .
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a EuclidAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a Image object to a EuclidAlienData object.
--
-- Private Method
--
FromPseudoColorImage( me : in out mutable ;
anImage : in PseudoColorImage from Image );
---Level: Internal
---Purpose : convert a Image object to a EuclidAlienData object.
FromColorImage( me : in out mutable ;
anImage : in ColorImage from Image );
---Level: Internal
---Purpose : convert a Image object to a EuclidAlienData object.
fields
myX1, myY1, myX2, myY2 : Integer from Standard ;
myNumberOfColor : Integer from Standard ;
myColors : Address from Standard ;
myPixels : HArray2OfInteger from TColStd ;
myPixelsIsDef : Boolean from Standard ;
end ;

View File

@@ -1,435 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#define TEST //GG_140699
// Check file extension, must be ".PIX".
#include <Aspect_GenericColorMap.hxx>
#include <Image_Convertor.hxx>
#include <Image_PseudoColorImage.hxx>
#include <AlienImage_EuclidAlienData.ixx>
#include <Aspect_ColorMapEntry.hxx>
#include <Standard.hxx>
#define xTRACE
#ifdef TRACE
static int Verbose = 1 ;
#endif
static const unsigned int EndOfPixelLine = 65535 ;
static const unsigned int EndOfPixelField = 65534 ;
#ifdef PAGESIZE // HPUX COMPATIBILLITY
#undef PAGESIZE
#endif
#define MAXCOUL 896
#define PAGESIZE 512
#define FIRST_EUCLID_IMAGE_COLOR 37
#define LAST_EUCLID_IMAGE_COLOR 180
#define ColorsSize() ( MAXCOUL*sizeof(int) )
#define COLOR(i) ( (( int * )myColors)[i-1] ) // Fortran Array Binding
//------------------------------------------------------------------------------
// Public Method
//------------------------------------------------------------------------------
AlienImage_EuclidAlienData::AlienImage_EuclidAlienData()
{
myX1 = myY1 = myX2 = myY2 = myNumberOfColor = 0 ;
myColors = NULL ;
myPixelsIsDef = Standard_False ;
}
void AlienImage_EuclidAlienData::Clear()
{
if ( myColors ) {
// Free memory
Standard::Free(myColors) ;
myColors = NULL ;
}
myPixelsIsDef = Standard_False ;
myX1 = myY1 = myX2 = myY2 = myNumberOfColor = 0 ;
}
Standard_Boolean AlienImage_EuclidAlienData::Read( OSD_File& file )
{ Standard_Integer bblcount, i ;
#ifdef TEST
OSD_Path path; file.Path(path);
TCollection_AsciiString ext = path.Extension(); ext.LowerCase();
if( ext != ".pix" ) {
TCollection_AsciiString sysname; path.SystemName(sysname);
#ifdef TRACE
cout << " *** AlienImage_EuclidAlienData::Read('" << sysname << "'). must have an '.PIX' extension" << endl;
#endif
return Standard_False;
}
#endif
if ( myColors == NULL )
myColors = Standard::Allocate( ColorsSize() ) ;
// Read in Header information
file.Read( myColors, ColorsSize(), bblcount ) ;
if ( file.Failed() || ( bblcount != ColorsSize() ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
myNumberOfColor = COLOR(1)+1 ;
myX1 = COLOR(2) ;
myY1 = COLOR(3) ;
myX2 = COLOR(4) ;
myY2 = COLOR(5) ;
#ifdef TRACE
if ( Verbose ) {
cout << "EuclidAlienData::Read(" << myNumberOfColor-1 << "," <<
myX1 << "," <<
myY1 << "," <<
myX2 << "," <<
myY2 << ")\n" << flush ;
}
#endif
myPixels = new TColStd_HArray2OfInteger( myX1, myX2, myY1, myY2, 0 ) ;
myPixelsIsDef = Standard_True ;
Standard_Boolean K_FLAG, K_LIGNE;
Standard_Integer INCRE, JNCRE, ILIGNE, NUMBLK, NMOT, NPIX, IPIXCR;
int LINPIX[(PAGESIZE*128)/sizeof(int)] ;
Standard_Address pLINPIX = ( Standard_Address ) LINPIX ;
K_FLAG = Standard_True ;
K_LIGNE = Standard_False ;
INCRE = myX1 ;
JNCRE = 1 ;
ILIGNE = myY1 ;
NUMBLK = 8 ;
NMOT = (PAGESIZE*128) ;
file.Seek( PAGESIZE*(NUMBLK-1), OSD_FromBeginning ) ;
file.Read( pLINPIX, NMOT*sizeof(int), bblcount ) ;
NUMBLK += 128 ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
while( K_FLAG ) {
while( !K_LIGNE ) {
NPIX = LINPIX[JNCRE-1] & 0xffff ;
IPIXCR = ( LINPIX[JNCRE-1] >> 16 ) & 0xffff ;
if ( IPIXCR == (Standard_Integer ) EndOfPixelLine ) {
K_LIGNE = Standard_True ;
}
else if ( IPIXCR < 512 ) {
for( i = 0 ; i < NPIX ; i++ ) {
myPixels->SetValue(INCRE,ILIGNE,IPIXCR & 0xff);
INCRE++ ;
}
JNCRE++ ;
if ( JNCRE >= NMOT ) {
file.Seek( PAGESIZE*(NUMBLK-1), OSD_FromBeginning ) ;
file.Read( pLINPIX, NMOT*sizeof(int),bblcount );
NUMBLK += 128 ;
JNCRE = 1 ;
if ( file.Failed() ){ // ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
}
else {
K_LIGNE = Standard_True ;
}
}
// Next Line
K_LIGNE = Standard_False ;
ILIGNE++ ;
INCRE = myX1 ;
JNCRE++ ;
IPIXCR = ( LINPIX[JNCRE-1] >> 16 ) & 0xffff ;
if ( IPIXCR == (Standard_Integer ) EndOfPixelField )
K_FLAG = Standard_False ; // End of Image
}
return Standard_True ;
}
Standard_Boolean AlienImage_EuclidAlienData::Write( OSD_File& file ) const
{ Standard_Integer x, y ;
Standard_Integer NUMBLK, NMOT, NPIX, MAXMOT ;
Standard_Integer ITSTPIX ;
int LINPIX[(PAGESIZE*128)/sizeof(int)] ;
if ( myNumberOfColor == 0 || myColors == NULL || ! myPixelsIsDef )
return Standard_False ;
MAXMOT = (PAGESIZE*128) / sizeof(int) ;
// Write in Header information
file.Write( myColors, ColorsSize() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
NUMBLK = 8 ;
NMOT = 0 ;
for ( y = myY1 ; y <= myY2 ; y++ ) {
x = myX1 ;
ITSTPIX = myPixels->Value( x, y ) ;
x++ ;
while( x <= myX2 ) {
NPIX = 1 ;
while ( myPixels->Value( x, y ) == ITSTPIX ) {
NPIX++ ;
x++ ;
if ( x > myX2 ) break ;// End of Pixel Line
}
LINPIX[NMOT] = ( ( ( ITSTPIX&0xff ) << 16 ) & 0xffff0000 ) |
( NPIX & 0xffff );
NMOT++ ;
if ( NMOT >= MAXMOT ) {
file.Seek( PAGESIZE*(NUMBLK-1), OSD_FromBeginning ) ;
file.Write( ( void *)LINPIX, NMOT*sizeof(int) );
NMOT = 0 ;
NUMBLK += 128 ;
}
if ( x <= myX2 ) {
ITSTPIX = myPixels->Value( x, y ) ;
x++ ;
if ( x == myX2 ) {// Last Pixel
LINPIX[NMOT] = ( ( (ITSTPIX&0xff)<<16 ) & 0xffff0000 ) |
( 1 & 0xffff );
NMOT++ ;
if ( NMOT >= MAXMOT ) {
file.Seek( PAGESIZE*(NUMBLK-1), OSD_FromBeginning ) ;
file.Write( ( void *)LINPIX, NMOT*sizeof(int) );
NMOT = 0 ;
NUMBLK += 128 ;
}
}
}
}
// End of Pixel Line
LINPIX[NMOT] = ( ( EndOfPixelLine<<16 ) & 0xffff0000 ) |
( 0 & 0xffff );
NMOT++ ;
if ( NMOT >= MAXMOT ) {
file.Seek( PAGESIZE*(NUMBLK-1), OSD_FromBeginning ) ;
file.Write( ( void *)LINPIX, NMOT*sizeof(int) );
NMOT = 0 ;
NUMBLK += 128 ;
}
}
// End of Pixel Field
LINPIX[NMOT] = ( ( EndOfPixelField<<16 ) & 0xffff0000 ) |
( 0 & 0xffff );
NMOT++ ;
file.Seek( PAGESIZE*(NUMBLK-1), OSD_FromBeginning ) ;
file.Write( ( void *)LINPIX, NMOT*sizeof(int) );
return Standard_False ;
}
Handle_Image_Image AlienImage_EuclidAlienData::ToImage() const
{ Standard_Real r,g,b ;
Standard_Integer x, y, i ;
Aspect_IndexPixel IPixel ;
Aspect_ColorMapEntry Centry ;
Quantity_Color color ;
if ( myNumberOfColor == 0 || myColors == NULL || ! myPixelsIsDef )
return NULL ;
Handle(Aspect_GenericColorMap) colormap = new Aspect_GenericColorMap() ;
Handle(Image_PseudoColorImage) PImage =
new Image_PseudoColorImage( myX1, myY1,
(myX2-myX1)+1, (myY2-myY1)+1, colormap ) ;
Handle(Image_Image) RetImage = PImage ;
// Get Colors
for ( i = 0 ; i < myNumberOfColor ; i++ ) {
r = ( Standard_Real ) COLOR(129+3*i) / 255. ;
g = ( Standard_Real ) COLOR(130+3*i) / 255. ;
b = ( Standard_Real ) COLOR(131+3*i) / 255. ;
color.SetValues( r,g,b, Quantity_TOC_RGB );
Centry.SetValue( i, color ) ;
colormap->AddEntry( Centry ) ;
}
for ( y = myY1 ; y <= myY2 ; y++ ) {
for ( x = myX1 ; x <= myX2 ; x++ ) {
IPixel.SetValue( myPixels->Value( x, y ) ) ;
PImage->SetPixel( x,myY2+myY1-y, IPixel ) ;
}
}
return RetImage ;
}
void AlienImage_EuclidAlienData::FromImage( const Handle_Image_Image& anImage )
{
if ( anImage->Type() == Image_TOI_PseudoColorImage ) {
Handle(Image_PseudoColorImage) aPImage =
Handle(Image_PseudoColorImage)::DownCast(anImage) ;
FromPseudoColorImage( aPImage ) ;
}
else if ( anImage->Type() == Image_TOI_ColorImage ) {
Handle(Image_ColorImage) aCImage =
Handle(Image_ColorImage)::DownCast(anImage) ;
FromColorImage( aCImage ) ;
}
else {
Standard_TypeMismatch_Raise_if( Standard_True,
"Attempt to convert a unknown Image_Image type to a EuclidAlienImage");
}
}
//------------------------------------------------------------------------------
// Private Method
//------------------------------------------------------------------------------
void AlienImage_EuclidAlienData::FromColorImage(
const Handle_Image_ColorImage& anImage)
{ Image_Convertor Convertor ;
Handle(Aspect_ColorMap) aCmap =
anImage->ChooseColorMap(LAST_EUCLID_IMAGE_COLOR-FIRST_EUCLID_IMAGE_COLOR+1);
Handle(Image_PseudoColorImage) aPImage = Convertor.Convert( anImage, aCmap ) ;
FromPseudoColorImage( aPImage ) ;
}
void AlienImage_EuclidAlienData::FromPseudoColorImage(
const Handle_Image_PseudoColorImage& PImage)
{
if ( myColors == NULL )
myColors = Standard::Allocate( ColorsSize() ) ;
//
// Euclid ColorMap goes from 0 to 255
// We must define all colors form 0 to 255 in a EUCLID .PIX file
//
Standard_Real r,g,b ;
Standard_Integer x, y, i, index ;
Aspect_IndexPixel IPixel ;
Aspect_ColorMapEntry Centry ;
Handle(Aspect_ColorMap) colormap = PImage->ColorMap() ;
for ( i = 1 ; i <= MAXCOUL ; i++ ) {
COLOR(i) = 0 ;
}
myX1 = PImage->LowerX() ; myX2 = PImage->UpperX() ;
myY1 = PImage->LowerY() ; myY2 = PImage->UpperY() ;
myPixels = new TColStd_HArray2OfInteger( myX1, myX2, myY1, myY2, 0 ) ;
myPixelsIsDef = Standard_True ;
myNumberOfColor = 0 ;
// Get Colors
for ( i = 1 ; i <= colormap->Size() ; i++ ) {
Centry = colormap->Entry( i ) ;
index = Centry.Index() ;
if ( index >= 0 && index <= 255 ) {
myNumberOfColor = Max( myNumberOfColor, index ) ;
Centry.Color().Values( r,g,b, Quantity_TOC_RGB ) ;
COLOR(129+3*index) = ( int ) ( r * 255. + 0.5 ) ;
COLOR(130+3*index) = ( int ) ( g * 255. + 0.5 ) ;
COLOR(131+3*index) = ( int ) ( b * 255. + 0.5 ) ;
}
}
COLOR(1) = myNumberOfColor ;
COLOR(2) = myX1;
COLOR(3) = myY1 ;
COLOR(4) = myX2 ;
COLOR(5) = myY2 ;
for ( y = myY1 ; y <= myY2 ; y++ ) {
for ( x = myX1 ; x <= myX2 ; x++ ) {
PImage->Pixel( x,myY2+myY1-y, IPixel ) ;
myPixels->SetValue( x, y, IPixel.Value() ) ;
}
}
}

View File

@@ -1,71 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: 02-06-98 : FMN ; Suppression appel Clear (deja fait dans ALienData)
class EuclidAlienImage from AlienImage inherits AlienUserImage from AlienImage
---Version: 0.0
---Purpose: This class defines an Euclid Alien image.
---Keywords:
---Warning:
---References:
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
EuclidAlienData from AlienImage
is
Create returns mutable EuclidAlienImage from AlienImage;
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by EuclidAlienImage
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : Converts a EuclidAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : converts a Image object to a EuclidAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Purpose: Reads content of a EuclidAlienImage object
-- from a file .
-- Returns True if file is a Euclid file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Purpose: Writes content of a EuclidAlienImage object
-- to a file .
fields
myData : EuclidAlienData from AlienImage ;
end ;

View File

@@ -1,91 +0,0 @@
-- Created on: 1998-10-20
-- Created by: DCB
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
private class GIFAlienData from AlienImage inherits AlienImageData from AlienImage
uses
File from OSD,
AsciiString from TCollection,
PseudoColorImage from Image,
ColorImage from Image,
Image from Image
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable GIFAlienData from AlienImage ;
Clear( me : in out mutable );
---Level: Public
---Purpose: Frees memory allocated by GIFAlienData
---C++: alias ~
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard;
---Level: Public
---Purpose: Read content of a GIFAlienData object from a file
-- Returns True if file is a GIF file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard;
---Level: Public
---Purpose: Write content of a GIFAlienData object to a file
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a GIFAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a Image object to a GIFAlienData object.
------------------------------------------------------
--- Private methods
------------------------------------------------------
FromPseudoColorImage (me : in out mutable;
anImage : in PseudoColorImage from Image )
is private;
---Level: Internal
---Purpose : convert a Image object to a GIFAlienData object.
FromColorImage (me : in out mutable;
anImage : in ColorImage from Image)
is private;
---Level: Internal
---Purpose : convert a Image object to a GIFAlienData object.
fields
myRedColors : Address from Standard;
myGreenColors : Address from Standard;
myBlueColors : Address from Standard;
myData : Address from Standard;
myWidth : Integer from Standard;
myHeight : Integer from Standard;
end;

View File

@@ -1,649 +0,0 @@
// Created by: DCB
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
// Notes:
// Read()/Write() code is taken from ZOV's sources from Xw package.
// _convert24to8() sources and all concerned code is taken from
// EUG's code of WNT_ImageProcessor.
#define TEST //GG_140699
// Check GIF format first.
#ifdef WNT
//it is important to undefine NOGDI and enforce including <windows.h> before
//Standard_Macro.hxx defines it and includes <windows.h> making GDI-related
//stuff unavailable and causing compilation errors
#undef NOGDI
#include <windows.h>
#endif
#include <AlienImage_GIFAlienData.ixx>
#include <AlienImage_GIFLZWDict.hxx>
#include <Aspect_GenericColorMap.hxx>
#include <Aspect_ColorMapEntry.hxx>
#include <Image_Convertor.hxx>
#include <Image_DitheringMethod.hxx>
#ifdef _DEBUG
//# define TRACE
#endif
#ifdef TRACE
# include <OSD_Timer.hxx>
#endif
#define STGMGR_ALLOC(size) Standard::Allocate(size)
#define STGMGR_FREE(buf,size) Standard::Free((void*&)buf)
#define COLORS_SIZE 256*sizeof(BYTE)
#define RED ((PBYTE)myRedColors)
#define GREEN ((PBYTE)myGreenColors)
#define BLUE ((PBYTE)myBlueColors)
#define PIXEL ((PBYTE)myData)
#define ZERO_COLORS() \
memset (myRedColors, 0, COLORS_SIZE); \
memset (myGreenColors, 0, COLORS_SIZE); \
memset (myBlueColors, 0, COLORS_SIZE);
#define _ADD_PIXEL(idx) \
{ \
if (y < height) \
*((PBYTE)myData + y*width + x) = ((BYTE)(idx)); \
if (++x == width) { \
x = 0; \
if (!isInterlace) ++y; \
else switch (pass) { \
case 0: y += 8; if (y >= height) ++pass, y = 4; break; \
case 1: y += 8; if (y >= height) ++pass, y = 2; break; \
case 2: y += 4; if (y >= height) ++pass, y = 1; break; \
default: y += 2; \
} \
} \
}
//================================================================
AlienImage_GIFAlienData::AlienImage_GIFAlienData()
: AlienImage_AlienImageData ()
{
myRedColors = NULL;
myGreenColors = NULL;
myBlueColors = NULL;
myData = NULL;
myWidth = 0;
myHeight = 0;
}
//================================================================
void AlienImage_GIFAlienData::Clear ()
{
if (myRedColors) {
STGMGR_FREE (myRedColors, COLORS_SIZE);
myRedColors = NULL;
}
if (myGreenColors) {
STGMGR_FREE (myGreenColors, COLORS_SIZE);
myGreenColors = NULL;
}
if (myBlueColors) {
STGMGR_FREE (myBlueColors, COLORS_SIZE);
myBlueColors = NULL;
}
if (myData) {
STGMGR_FREE (myData, myWidth*myHeight);
myData = NULL;
myWidth = myHeight = 0;
}
}
//================================================================
Standard_Boolean AlienImage_GIFAlienData::Read (OSD_File& file)
{
Standard_Integer nFileSize = file.Size(), nReadCount;
unsigned *OutCode=NULL, *Prefix=NULL, *Suffix=NULL,
BitMask, CodeSize, ClearCode, EOFCode, FreeCode, x, y, pass, width, height,
InitCodeSize, MaxCode, ReadMask, FirstFree, OutCount, BitOffset,
ByteOffset, Code, CurCode, OldCode=0, FinChar=0, InCode;
int isInterlace, hasColormap;
int i, ncolors;
BYTE byte, byte1;
PBYTE pFileStream = NULL;
// Allocate memory to read the file
PBYTE pFileBuffer =
(PBYTE) STGMGR_ALLOC (nFileSize);
PBYTE rasterPtr = NULL, ptr1;
pFileStream = pFileBuffer + 10;
#ifdef TRACE
OSD_Timer timer;
cout << "AlienImage_GIFAlienData::Read () starts" << endl << flush;
timer.Start ();
#endif
// Read file into memory
file.Read ((void*&)pFileBuffer, nFileSize, nReadCount);
if (nFileSize != nReadCount) {
cout << "GIFAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
#ifdef TEST
if( strncmp ((char*)pFileBuffer, "GIF87a", 6) &&
strncmp ((char*)pFileBuffer, "GIF89a", 6) )
goto _ExitReadError;
#endif
// Determine if the image has colormap
byte = *pFileStream++; // Color descriptor byte (M#CR0#BP)
hasColormap = byte & 0x80;
ncolors = hasColormap ? 1<<((byte & 0x07) + 1): 1<<8;
BitMask = ncolors - 1;
pFileStream += 2; // Skip background byte and following zero byte
if (ncolors > 0 && ncolors <= 256) { // Allocate Color Table entries
myRedColors = STGMGR_ALLOC (COLORS_SIZE);
myGreenColors = STGMGR_ALLOC (COLORS_SIZE);
myBlueColors = STGMGR_ALLOC (COLORS_SIZE);
ZERO_COLORS ();
for (i=0; i<ncolors; i++) {
// Fill in array of XColor's used
// Note, that if there's no colormap specified then I use gray scale
RED [i] = ((BYTE)(hasColormap ? *pFileStream++: i));
GREEN[i] = ((BYTE)(hasColormap ? *pFileStream++: i));
BLUE [i] = ((BYTE)(hasColormap ? *pFileStream++: i));
}
} else {
cout << "GIFAlienData::Read() : There's no colormap"
<< " in the image (or too big): " << ncolors << endl << flush;
goto _ExitReadError;
}
// Skip extension blocks if any.
// Format: <'!'><size><...><size><...><0>
while (*pFileStream == '!') {
pFileStream += 2; // skip code byte followed '!' sign
while (*pFileStream)
pFileStream += (unsigned)(1 + *(PBYTE)pFileStream);
pFileStream ++;
}
if (*pFileStream++ != ',') { // must be an image descriptor
cout << "GIFAlienData::Read() : There's no separator"
<< " following the colormap" << endl << flush;
goto _ExitReadError;
}
pFileStream += 2*2; // Skip image left & top offsets
width = (unsigned) *pFileStream++;
width += ((unsigned)*pFileStream++) << 8;
height = (unsigned) *pFileStream++;
height += ((unsigned)*pFileStream++) << 8;
byte = *pFileStream++;
isInterlace = byte & 0x40;
if (byte & 0x80) {
cout << "GIFAlienData::Read() : Can't read GIF image"
<< " with locally defined colormap" << endl << flush;
goto _ExitReadError;
}
// Allocate the pixel buffer
rasterPtr = (PBYTE) STGMGR_ALLOC (nFileSize);
OutCode = (unsigned *) STGMGR_ALLOC (1025 * sizeof (unsigned int));
Prefix = (unsigned *) STGMGR_ALLOC (4096 * sizeof (unsigned int));
Suffix = (unsigned *) STGMGR_ALLOC (4096 * sizeof (unsigned int));
// Decode compressed raster data.
CodeSize = *pFileStream++;
ClearCode = 1 << CodeSize;
EOFCode = ClearCode + 1;
FreeCode = FirstFree = EOFCode + 1;
++CodeSize;
InitCodeSize = CodeSize;
MaxCode = 1 << CodeSize;
ReadMask = MaxCode - 1;
ptr1 = rasterPtr;
// Read encoded data to a continuous array pointed to by rasterPtr
do {
byte = byte1 = *pFileStream++;
while (byte--)
*ptr1++ = *pFileStream++;
if ((long) (ptr1 - rasterPtr) > nFileSize) {// Currupt file
cout << "GIFAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
} while (byte1);
// The file data has been already read
STGMGR_FREE (pFileBuffer, nFileSize);
pFileBuffer = NULL;
// Allocate image data
myWidth = width;
myHeight = height;
myData = STGMGR_ALLOC (myWidth*myHeight);
x = y = pass = OutCount = BitOffset = ByteOffset = 0;
// Fetch the next code (3 to 12 bits) from the raster data stream
Code = rasterPtr[0] + (((unsigned) rasterPtr[1]) << 8);
if (CodeSize >= 8)
Code += ((unsigned) rasterPtr[2]) << 16;
Code >>= BitOffset & 0x7;
BitOffset += CodeSize;
Code &= ReadMask;
while (Code != EOFCode) {
if (Code == ClearCode) {
// Read the next code
CodeSize = InitCodeSize;
MaxCode = 1 << CodeSize;
ReadMask = MaxCode - 1;
FreeCode = FirstFree;
ByteOffset = BitOffset >> 3;
Code = rasterPtr[ByteOffset]
+ (((unsigned) rasterPtr[ByteOffset + 1]) << 8);
if (CodeSize >= 8)
Code += ((unsigned) rasterPtr[ByteOffset + 2]) << 16;
Code >>= BitOffset & 0x7;
BitOffset += CodeSize;
Code &= ReadMask;
CurCode = OldCode = Code;
FinChar = CurCode & BitMask;
_ADD_PIXEL (FinChar);
} else {
CurCode = InCode = Code;
if (CurCode >= FreeCode) {
CurCode = OldCode;
OutCode[OutCount++] = FinChar;
}
while (CurCode > BitMask) {
if (OutCount > 1024) {
cout << "GIFAlienData::Read() : BAD file size." << endl << flush;
goto _ExitReadError;
}
OutCode [OutCount++] = Suffix [CurCode];
CurCode = Prefix [CurCode];
}
FinChar = CurCode & BitMask;
OutCode [OutCount++] = FinChar;
for (i = OutCount - 1; i >= 0; --i)
_ADD_PIXEL (OutCode [i]);
OutCount = 0;
Prefix [FreeCode] = OldCode;
Suffix [FreeCode] = FinChar;
OldCode = InCode;
++FreeCode;
if (FreeCode >= MaxCode) {
if (CodeSize < 12) {
++CodeSize;
MaxCode <<= 1;
ReadMask = (1 << CodeSize) - 1;
}
}
}
ByteOffset = BitOffset >> 3;
Code = (unsigned) rasterPtr[ByteOffset]
+ (((unsigned) rasterPtr[ByteOffset + 1]) << 8);
if (CodeSize >= 8)
Code += ((unsigned) rasterPtr[ByteOffset + 2]) << 16;
Code >>= (BitOffset & 0x7);
BitOffset += CodeSize;
Code &= ReadMask;
} // while (Code != EOFCode)
// Free allocated memory
STGMGR_FREE (rasterPtr, nFileSize);
STGMGR_FREE (OutCode, 1025 * sizeof (unsigned int));
STGMGR_FREE (Prefix, 4096 * sizeof (unsigned int));
STGMGR_FREE (Suffix, 4096 * sizeof (unsigned int));
#ifdef TRACE
timer.Stop ();
timer.Show (cout);
cout << "AlienImage_GIFAlienData::Read () finished\n" << endl << flush;
#endif
return Standard_True;
_ExitReadError:
// cout << "GIFAlienData::Read() : Read file error." << endl << flush;
if (pFileBuffer) STGMGR_FREE (pFileBuffer, nFileSize);
if (OutCode) STGMGR_FREE (OutCode, 1025 * sizeof (unsigned int));
if (Prefix) STGMGR_FREE (Prefix, 4096 * sizeof (unsigned int));
if (Suffix) STGMGR_FREE (Suffix, 4096 * sizeof (unsigned int));
if (myRedColors) {
STGMGR_FREE (myRedColors, COLORS_SIZE);
myRedColors = NULL;
}
if (myGreenColors) {
STGMGR_FREE (myGreenColors, COLORS_SIZE);
myGreenColors = NULL;
}
if (myBlueColors) {
STGMGR_FREE (myBlueColors, COLORS_SIZE);
myBlueColors = NULL;
}
if (myData) {
STGMGR_FREE (myData, myWidth*myHeight);
myData = NULL;
myWidth = myHeight = 0;
}
return Standard_False;
}
//================================================================
Standard_Boolean AlienImage_GIFAlienData::Write (OSD_File& file) const
{
SCREEN_DESCR sd;
IMAGE_DESCR id;
BYTE image_sep = 0x2C; // gif colormap delimiter
WORD wZero = 0x00;
BYTE colors256 [256][3];
BYTE bEnd = 0x3B;
int i;
#ifdef TRACE
OSD_Timer timer;
cout << "AlienImage_GIFAlienData::Write () starts" << endl << flush;
timer.Start ();
#endif
// Check if image is loaded
if (myData == NULL || myRedColors == NULL ||
myGreenColors == NULL || myBlueColors == NULL ||
myWidth == 0 || myHeight == 0)
goto _ExitWriteError;
// Build file header
memcpy (sd.gifID, "GIF87a", 6);
sd.scrnWidth = SWAP_WORD ((WORD) myWidth );
sd.scrnHeight = SWAP_WORD ((WORD) myHeight);
sd.scrnFlag = 0x80 | ( ( 7/*[=depth-1]*/ << 4 ) & 0x70 ) | 0x07;
id.imgX = 0;
id.imgY = 0;
id.imgWidth = SWAP_WORD ((WORD) myWidth );
id.imgHeight = SWAP_WORD ((WORD) myHeight);
// imgFlag
// +-+-+-+-+-+-----+ M=0 - Use global color map, ignore 'pixel'
// |M|I|0|0|0|pixel| 10 M=1 - Local color map follows, use 'pixel'
// +-+-+-+-+-+-----+ I=0 - Image formatted in Sequential order
// I=1 - Image formatted in Interlaced order
// pixel+1 - # bits per pixel for this image
id.imgFlag = 0x07; // Global color map, Sequential order, 8 bits per pixel
for (i = 0; i < 256; i++) {
colors256[i] [0/*R*/] = RED [i];
colors256[i] [1/*G*/] = GREEN [i];
colors256[i] [2/*B*/] = BLUE [i];
}
// Write off the buffers
file.Write (&sd, 11); // Screen descriptor
if (file.Failed())
goto _ExitWriteError;
file.Write (&wZero, 2); // Zero word
if (file.Failed())
goto _ExitWriteError;
file.Write (colors256, 256*3); // Colormap
if (file.Failed())
goto _ExitWriteError;
file.Write (&image_sep, 1); // Separator
if (file.Failed())
goto _ExitWriteError;
file.Write (&id, 9); // Image descriptor
if (file.Failed())
goto _ExitWriteError;
// Write off the image data
if (!_lzw_encode (file, (PBYTE) myData, myWidth, myHeight, myWidth))
goto _ExitWriteError;
file.Write (&bEnd, 1); // End of image
if (file.Failed())
goto _ExitWriteError;
// Return SUCCESS status if there were no errors.
#ifdef TRACE
timer.Stop ();
timer.Show (cout);
cout << "AlienImage_GIFAlienData::Write () finished\n" << endl << flush;
#endif
return Standard_True;
// Exit on error
_ExitWriteError:
file.Seek (0, OSD_FromBeginning);
return Standard_False;
}
//================================================================
Handle_Image_Image AlienImage_GIFAlienData::ToImage () const
{
#ifdef TRACE
OSD_Timer timer;
cout << "AlienImage_GIFAlienData::ToImage () starts" << endl << flush;
timer.Start ();
#endif
Standard_Integer i, x, y, LowX, LowY;
Standard_Real r, g, b;
Aspect_ColorMapEntry entry;
Aspect_IndexPixel index;
Quantity_Color color;
// Build colormap
Handle(Aspect_GenericColorMap) aColorMap =
new Aspect_GenericColorMap ();
for (i = 0; i < 256; i++) {
r = ((float)RED [i] / 255.);
g = ((float)GREEN [i] / 255.);
b = ((float)BLUE [i] / 255.);
color.SetValues (r, g, b, Quantity_TOC_RGB);
entry.SetValue (i, color);
aColorMap -> AddEntry (entry);
}
// Fill image data
Handle(Image_Image) theImage =
new Image_PseudoColorImage (0, 0, myWidth, myHeight, aColorMap);
LowX = theImage -> LowerX ();
LowY = theImage -> LowerY ();
for (y = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
index.SetValue (PIXEL[y*myWidth + x]);
theImage -> SetPixel (LowX + x, LowY + y, index);
}
}
#ifdef TRACE
timer.Stop ();
timer.Show (cout);
cout << "AlienImage_GIFAlienData::ToImage () finished\n" << endl << flush;
#endif
return theImage;
}
//================================================================
void AlienImage_GIFAlienData::FromImage (const Handle_Image_Image& anImage)
{
if (anImage -> Type() == Image_TOI_PseudoColorImage) {
// Build from PseudoColorImage
Handle(Image_PseudoColorImage) aPImage =
Handle(Image_PseudoColorImage)::DownCast(anImage);
FromPseudoColorImage (aPImage);
} else if (anImage -> Type() == Image_TOI_ColorImage) {
// Build from ColorImage
Handle(Image_ColorImage) aCImage =
Handle(Image_ColorImage)::DownCast(anImage);
FromColorImage (aCImage);
} else {
// Unknown type of image
Standard_TypeMismatch_Raise_if (Standard_True,
"Attempt to convert a unknown Image_Image type to a GIFAlienData");
}
}
//================================================================
void AlienImage_GIFAlienData::FromPseudoColorImage (
const Handle(Image_PseudoColorImage)& anImage)
{
int width = anImage -> Width ();
int height = anImage -> Height ();
unsigned short x, y, i;
Standard_Real r, g, b;
Aspect_ColorMapEntry entry;
Aspect_IndexPixel index;
Quantity_Color color;
Standard_Integer LowX = anImage -> LowerX();
Standard_Integer LowY = anImage -> LowerY();
BYTE ei;
#ifdef TRACE
OSD_Timer timer;
cout << "AlienImage_GIFAlienData::FromPseudoColorImage () starts" << endl << flush;
timer.Start ();
#endif
if (width*height > 0) {
Handle(Aspect_ColorMap) aColorMap = anImage -> ColorMap ();
// Clear old values if any
Clear ();
myRedColors = STGMGR_ALLOC (COLORS_SIZE);
myGreenColors = STGMGR_ALLOC (COLORS_SIZE);
myBlueColors = STGMGR_ALLOC (COLORS_SIZE);
ZERO_COLORS ();
// Build colors from colormap
for (i = 1; i <= aColorMap -> Size (); i++) {
entry = aColorMap -> Entry (i);
ei = entry.Index ();
color = entry.Color ();
color.Values (r, g, b, Quantity_TOC_RGB);
RED [ei] = (BYTE)(r*255.);
GREEN[ei] = (BYTE)(g*255.);
BLUE [ei] = (BYTE)(b*255.);
}
// Build imagedata from Image_PseudoColorImage
myWidth = width;
myHeight = height;
myData = STGMGR_ALLOC (myWidth*myHeight);
for (y = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
index = anImage -> Pixel (LowX + x, LowY + y);
PIXEL[y*myWidth + x] = (BYTE)index.Value ();
}
}
}
#ifdef TRACE
timer.Stop ();
timer.Show (cout);
cout << "AlienImage_GIFAlienData::FromPseudoColorImage () finished\n" << endl << flush;
#endif
}
//================================================================
void AlienImage_GIFAlienData::FromColorImage (
const Handle(Image_ColorImage)& anImage)
{
#ifdef TRACE
OSD_Timer timer;
cout << "AlienImage_GIFAlienData::FromColorImage () starts" << endl << flush;
timer.Start ();
#endif // TRACE
int width = anImage -> Width ();
int height = anImage -> Height ();
int i, x, y, LowX = anImage -> LowerX(), LowY = anImage -> LowerY();
Quantity_Color color;
Standard_Real r, g, b;
if (width*height > 0) {
Aspect_ColorMapEntry entry;
// Clear old values if any
Clear ();
myWidth = width;
myHeight = height;
LPRGBQUAD pColors = (LPRGBQUAD) STGMGR_ALLOC (256*sizeof(RGBQUAD));
PBYTE pBits24 = (PBYTE) STGMGR_ALLOC (width*height*3);
memset (pColors, 0, 256*sizeof(RGBQUAD));
myData = STGMGR_ALLOC (width*height);
myRedColors = STGMGR_ALLOC (COLORS_SIZE);
myGreenColors = STGMGR_ALLOC (COLORS_SIZE);
myBlueColors = STGMGR_ALLOC (COLORS_SIZE);
for (y = 0, i = 0; y < myHeight; y++) {
for (x = 0; x < myWidth; x++) {
color = anImage -> PixelColor (LowX + x, LowY + y);
color.Values (r, g, b, Quantity_TOC_RGB);
pBits24 [i + 0] = (BYTE)(b*255.);
pBits24 [i + 1] = (BYTE)(g*255.);
pBits24 [i + 2] = (BYTE)(r*255.);
i += 3;
}
}
if (_convert24to8 (pColors, pBits24, (PBYTE)myData, myWidth, myHeight)) {
Handle(Aspect_GenericColorMap) aColorMap = new Aspect_GenericColorMap ();
for (i = 0; i < 256; i++) {
r = ((float)pColors[i].rgbRed / 255.);
g = ((float)pColors[i].rgbGreen / 255.);
b = ((float)pColors[i].rgbBlue / 255.);
color.SetValues (r, g, b, Quantity_TOC_RGB);
entry.SetValue (i, color);
aColorMap -> AddEntry (entry);
RED [i] = pColors[i].rgbRed;
GREEN[i] = pColors[i].rgbGreen;
BLUE [i] = pColors[i].rgbBlue;
}
} else {
Image_Convertor aConvertor;
aConvertor.SetDitheringMethod (Image_DM_ErrorDiffusion);
Handle(Aspect_ColorMap) aColorMap = anImage -> ChooseColorMap (256);
Handle(Image_PseudoColorImage) aPImage =
aConvertor.Convert (anImage, aColorMap);
FromPseudoColorImage (aPImage);
}
STGMGR_FREE (pColors, 256*sizeof(RGBQUAD));
STGMGR_FREE (pBits24, width*height*3);
}
#ifdef TRACE
timer.Stop ();
timer.Show (cout);
cout << "AlienImage_GIFAlienData::FromColorImage () finished\n" << endl << flush;
#endif // TRACE
}

View File

@@ -1,73 +0,0 @@
-- Created on: 1998-10-20
-- Created by: DCB
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class GIFAlienImage from AlienImage inherits AlienUserImage from AlienImage
uses
GIFAlienData from AlienImage,
File from OSD,
AsciiString from TCollection,
Image from Image
is
Create
returns mutable GIFAlienImage from AlienImage;
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by GIFAlienImage
---C++: alias ~
SetName( me : in out mutable;
aName : in AsciiString from TCollection) ;
---Level: Public
---Purpose: Set Image name .
Name( me : in immutable ) returns AsciiString from TCollection ;
---C++: return const &
---Level: Public
---Purpose: get Image name .
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : convert a GIFAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : convert a Image object to a GIFAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a GIFAlienImage object from a file .
-- Returns True if file is a GIF file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a GIFAlienImage object to a file .
fields
myData : GIFAlienData from AlienImage;
end;

View File

@@ -1,70 +0,0 @@
// Created by: DCB
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_GIFAlienImage.ixx>
//================================================================
AlienImage_GIFAlienImage::AlienImage_GIFAlienImage ()
{
myData = new AlienImage_GIFAlienData() ;
}
//================================================================
void AlienImage_GIFAlienImage::Clear ()
{
myData->Clear();
}
//================================================================
void AlienImage_GIFAlienImage::SetName (const TCollection_AsciiString& aName)
{
myData->SetName (aName);
}
//================================================================
const TCollection_AsciiString& AlienImage_GIFAlienImage::Name () const
{
return (myData->Name());
}
//================================================================
Standard_Boolean AlienImage_GIFAlienImage::Write (OSD_File& file) const
{
return myData->Write(file);
}
//================================================================
Standard_Boolean AlienImage_GIFAlienImage::Read (OSD_File& file)
{
return myData->Read(file);
}
//================================================================
Handle_Image_Image AlienImage_GIFAlienImage::ToImage () const
{
return myData->ToImage();
}
//================================================================
void AlienImage_GIFAlienImage::FromImage (const Handle_Image_Image& anImage)
{
myData->FromImage(anImage);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,114 +0,0 @@
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//============================================================================
//==== Titre: AlienImage_GIFLZWDict.hxx
//============================================================================
#ifndef _AlienImage_GIFLZWDict_HeaderFile
#define _AlienImage_GIFLZWDict_HeaderFile
//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_GIFLZWDict);
//============================================================================
#include <OSD_File.hxx>
#ifndef WNT
typedef unsigned int DWORD; // 32-bit signed
typedef int LONG; // 32-bit unsigned
typedef unsigned int ULONG, UINT; // 32-bit signed
typedef unsigned short WORD; // 16-bit unsigned
typedef unsigned char BYTE; // 8-bit unsigned
typedef unsigned int BOOL;
typedef int* PINT;
typedef unsigned char* PBYTE;
typedef void* LPVOID;
#else
#ifdef NOGDI
#undef NOGDI /* we need GDI definitions here... */
#endif
# include <windows.h>
#endif
#if defined(__alpha) || defined(DECOSF1) || defined(WNT)
# define SWAP_WORD(__w) (__w)
# define SWAP_DWORD(__w) (__w)
#else
# define SWAP_WORD(__w) ((((__w)&0xFF) << 8) | (((__w)&0xFF00) >> 8))
# define SWAP_DWORD(__w) ((((__w)&0x000000FF) << 24) | (((__w)&0x0000FF00) << 8) \
| (((__w)&0xFF0000) >> 8) | (((__w)&0xFF000000) >> 24) )
#endif
#define NBITS 12
#define TBL_SIZE 5021
#define MAX_CODE ( ( 1 << NBITS ) - 1 )
#define BUFF_SIZE 255
#define UNUSED -1
#define TRUE 1
#define FALSE 0
//=============================================================================
// Functions and structs to write GIF image to file.
//=============================================================================
extern int _lzw_encode (OSD_File&, const BYTE*, int, int, int);
typedef struct {
char gifID[ 6 ];
WORD scrnWidth;
WORD scrnHeight;
BYTE scrnFlag;
} SCREEN_DESCR;
typedef struct {
WORD imgX;
WORD imgY;
WORD imgWidth;
WORD imgHeight;
BYTE imgFlag;
} IMAGE_DESCR;
typedef struct {
int code;
int prnt;
BYTE byte;
} AlienImage_GIFLZWDict;
//=============================================================================
// Functions to convert from 24 to 8 color image
//=============================================================================
#define PAD(a) ( ( a ) % sizeof ( LONG ) ? \
sizeof ( LONG ) - ( ( a ) % sizeof ( LONG ) ) : 0 )
#define MALLOC(s) calloc ( ( s ), 1 )
#define FREE(p) free ( ( p ) )
#ifndef WNT
typedef struct {
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved;
} RGBQUAD, *LPRGBQUAD;
#define __fastcall
#endif // WNT
BOOL __fastcall _convert24to8 (LPRGBQUAD, PBYTE, PBYTE, int, int);
#endif // _AlienImage_GIFLZWDict_HeaderFile

View File

@@ -1,57 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL,JLF
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class MemoryOperations from AlienImage
---Version: 0.0
---Level: Public
---Purpose: This class defines class method for
-- memory mangement .
---Keywords:
---Warning:
---References:
--uses
raises
NullObject
is
SwapLong ( myclass ; Data : in Address from Standard
; Size : in Integer from Standard )
---Level: Internal
---Purpose: Swap byte in a long word ( 32 Bit )
-- Size is the number of long word to swap
-- ex : SwapLong( "abcd". 1 ) gives "dcba"
--
raises NullObject;
SwapShort( myclass ; Data : in Address from Standard
; Size : in Integer from Standard )
---Level: Internal
---Purpose: Swap byte in a short word ( 16 Bit )
-- Size is the number of short word to swap
-- ex : SwapShort( "ab". 1 ) gives "ba"
--
raises NullObject;
end MemoryOperations;

View File

@@ -1,68 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Standard_NullObject.hxx>
#include <AlienImage_MemoryOperations.ixx>
void AlienImage_MemoryOperations::SwapLong( const Standard_Address Data,
const Standard_Integer Size )
{
register char c;
register char *bp = ( char * )Data ;
register char *ep = ( char * )Data + Size ;
register char *sp;
if ( Data == NULL)
Standard_NullObject::Raise("AlienImage_MemoryOperations : SwapLong");
while (bp < ep) {
sp = bp + 3;
c = *sp;
*sp = *bp;
*bp++ = c;
sp = bp + 1;
c = *sp;
*sp = *bp;
*bp++ = c;
bp += 2;
}
}
void AlienImage_MemoryOperations::SwapShort( const Standard_Address Data,
const Standard_Integer Size )
{
register char c;
register char *ep = ( char * )Data + Size ;
register char *bp = ( char * )Data ;
if ( Data == NULL)
Standard_NullObject::Raise("AlienImage_MemoryOperations : SwapLong");
while (bp < ep) {
c = *bp;
*bp = *(bp + 1);
bp++;
*bp++ = c;
}
}

View File

@@ -1,107 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class SGIRGBAlienData from AlienImage inherits AlienImageData from AlienImage
---Version: 0.0
---Purpose: This class defines a SGI .rgb Alien image.
---Keywords:
---Warning:
---References:
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
X11XColor from AlienImage,
SGIRGBFileHeader from AlienImage
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable SGIRGBAlienData from AlienImage ;
Clear( me : in out mutable ) ;
---Level: Public
---Purpose: Frees memory allocated by SGIRGBAlienData
---C++: alias ~
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a SGIRGBAlienData object from a file .
-- Returns True if file is a SGI .rgb file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a SGIRGBAlienData object to a file .
SetName( me : in out mutable ;
aName : in AsciiString from TCollection)
is redefined;
---Level: Public
---Purpose: Set Image name .
Name( me : in immutable ) returns AsciiString from TCollection
is redefined;
---C++: return const &
---Level: Public
---Purpose: Get Image name .
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a SGIRGBAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a Image object to a SGIRGBAlienData object.
--
-- Private Method
--
ToPseudoColorImage( me : in immutable)
returns PseudoColorImage from Image is private ;
---Level: Internal
---Purpose : convert a AlienImage object to a Image object.
ToColorImage( me : in immutable)
returns ColorImage from Image is private ;
---Level: Internal
---Purpose : convert a AlienImage object to a Image object.
fields
myHeader : SGIRGBFileHeader from AlienImage is protected ;
myRedData, myGreenData, myBlueData : Address from Standard is protected;
-- ( unsigned short * )
end ;

File diff suppressed because it is too large Load Diff

View File

@@ -1,75 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: 02-06-98 : FMN ; Suppression appel Clear (deja fait dans ALienData)
class SGIRGBAlienImage from AlienImage inherits AlienUserImage from AlienImage
---Purpose: Defines an SGI .rgb Alien image, i.e. an image using
-- the image format for Silicon Graphics workstations.
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
SGIRGBAlienData from AlienImage
is
Create returns mutable SGIRGBAlienImage from AlienImage;
---Purpose: Constructs an empty SGI .rgb Alien image.
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by SGIRGBAlienImage
SetName( me : in out mutable;
aName : in AsciiString from TCollection) ;
---Level: Public
---Purpose: Set Image name .
Name( me : in immutable ) returns AsciiString from TCollection ;
---C++: return const &
---Purpose: Reads the Image name .
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : Converts a SGIRGBAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : Converts a Image object to a SGIRGBAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Purpose: Reads content of a SGIRGBAlienImage object from a file
-- Returns True if file is a XWD file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Purpose: Writes content of a SGIRGBAlienImage object to a file
fields
myData : SGIRGBAlienData from AlienImage;
end ;

View File

@@ -1,53 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_SGIRGBAlienImage.ixx>
AlienImage_SGIRGBAlienImage::AlienImage_SGIRGBAlienImage()
{ // il faut faire un new si mydata est du type HANDLE
myData = new AlienImage_SGIRGBAlienData() ;
}
void AlienImage_SGIRGBAlienImage::SetName( const TCollection_AsciiString& aName)
{ myData->SetName( aName ) ; }
const TCollection_AsciiString& AlienImage_SGIRGBAlienImage::Name() const
{ return( myData->Name() ) ; }
void AlienImage_SGIRGBAlienImage::Clear()
{ myData->Clear() ; }
Standard_Boolean AlienImage_SGIRGBAlienImage::Write( OSD_File& file ) const
{ return( myData->Write( file ) ) ; }
Standard_Boolean AlienImage_SGIRGBAlienImage::Read( OSD_File& file )
{ return( myData->Read( file ) ) ; }
Handle_Image_Image AlienImage_SGIRGBAlienImage::ToImage() const
{ return( myData->ToImage() ) ; }
void AlienImage_SGIRGBAlienImage::FromImage( const Handle_Image_Image& anImage )
{ myData->FromImage( anImage ) ; }

View File

@@ -1,50 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_SGIRGBFileHeader.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_SGIRGBFileHeader)
{
static Handle(Standard_Type) _atype =
new Standard_Type ("AlienImage_SGIRGBFileHeader", sizeof (AlienImage_SGIRGBFileHeader));
return _atype;
}
Standard_Boolean operator == ( const AlienImage_SGIRGBFileHeader& AnObject,
const AlienImage_SGIRGBFileHeader& AnotherObject )
{ Standard_Boolean _result = Standard_True;
return _result;
}
//============================================================================
//==== ShallowDump : Writes a CString value.
//============================================================================
void ShallowDump (const AlienImage_SGIRGBFileHeader& AnObject, Standard_OStream& s)
{
s << "AlienImage_SGIRGBFileHeader\n" ;
}
ostream& operator << ( ostream& s, const AlienImage_SGIRGBFileHeader& c )
{
return( s << "AlienImage_SGIRGBFileHeader " );
}

View File

@@ -1,104 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//============================================================================
//==== Titre: AlienImage_SGIRGBFileHeader.hxx
//==== Role : The header file of primitve type "SGIRGBFileHeader"
//==== Implementation: This is a primitive type implemented with typedef
//==== typedef SGIRGBSGIRGBFileHeader AlienImage_SGIRGBFileHeader;
//============================================================================
#ifndef _AlienImage_SGIRGBFileHeader_HeaderFile
#define _AlienImage_SGIRGBFileHeader_HeaderFile
//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_SGIRGBFileHeader);
//============================================================================
#define IMAGIC 0732
/* colormap of images */
#define CM_NORMAL 0 /* file contains rows of values which
* are either RGB values (zsize == 3)
* or greyramp values (zsize == 1) */
#define CM_DITHERED 1
#define CM_SCREEN 2 /* file contains data which is a screen
* image; getrow returns buffer which
* can be displayed directly with
* writepixels */
#define CM_COLORMAP 3 /* a colormap file */
#define TYPEMASK 0xff00
#define BPPMASK 0x00ff
#define ITYPE_VERBATIM 0x0000
#define ITYPE_RLE 0x0100
#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
#define BPP(type) ((type) & BPPMASK)
#define RLE(bpp) (ITYPE_RLE | (bpp))
#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
#define IBUFSIZE(pixels) ((pixels+(pixels>>6))<<2)
#define RLE_NOP 0x00
#define ierror(p) (((p)->flags&_IOERR)!=0)
#define ifileno(p) ((p)->file)
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
#define putpix(p,x) (--(p)->cnt>=0 \
? ((int)(*(p)->ptr++=(unsigned)(x))) \
: iflsbuf(p,(unsigned)(x)))
typedef struct {
unsigned short imagic; /* stuff saved on disk . . */
unsigned short type;
unsigned short dim;
unsigned short xsize;
unsigned short ysize;
unsigned short zsize;
unsigned int min;
unsigned int max;
unsigned int wastebytes;
char name[80];
unsigned int colormap;
int file; /* stuff used in core only */
unsigned short flags;
short dorev;
short x;
short y;
short z;
short cnt;
unsigned short *ptr;
unsigned short *base;
unsigned short *tmpbuf;
unsigned int offset;
unsigned int rleend; /* for rle images */
unsigned int *rowstart; /* for rle images */
int *rowsize; /* for rle images */
} AlienImage_SGIRGBFileHeader;
AlienImage_SGIRGBFileHeader *iopen();
AlienImage_SGIRGBFileHeader *icreate();
ostream& operator << ( ostream& s, const AlienImage_SGIRGBFileHeader& h );
Standard_Boolean operator==(const AlienImage_SGIRGBFileHeader& AnObject,
const AlienImage_SGIRGBFileHeader& AnotherObject) ;
void ShallowDump (const AlienImage_SGIRGBFileHeader& AnObject,Standard_OStream& S) ;
#endif

View File

@@ -1,57 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_SUNRFFileHeader.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_SUNRFFileHeader)
{
static Handle(Standard_Type) _atype =
new Standard_Type ("AlienImage_SUNRFFileHeader", sizeof (AlienImage_SUNRFFileHeader));
return _atype;
}
Standard_Boolean operator == ( const AlienImage_SUNRFFileHeader& AnObject,
const AlienImage_SUNRFFileHeader& AnotherObject )
{ Standard_Boolean _result = Standard_True;
return _result;
}
//============================================================================
//==== ShallowDump : Writes a CString value.
//============================================================================
void ShallowDump (const AlienImage_SUNRFFileHeader& AnObject, Standard_OStream& s)
{
s << AnObject ;
}
ostream& operator << ( ostream& s, const AlienImage_SUNRFFileHeader& c )
{
return( s << "AlienImage_SUNRFFileHeader :"
<< "\n\tmagic :" << c.ras_magic
<< "\n\twidth :" << c.ras_width
<< "\n\theight :" << c.ras_height
<< "\n\tdepth :" << c.ras_depth
<< "\n\tlength :" << c.ras_length
<< "\n\tmaptype :" << c.ras_maptype
<< "\n\tmaplength:" << c.ras_maplength << endl << flush );
}

View File

@@ -1,83 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//============================================================================
//==== Titre: AlienImage_SUNRFFileHeader.hxx
//==== Role : The header file of primitve type "SUNRFFileHeader"
//==== Implementation: This is a primitive type implemented with typedef
//==== typedef SUNRFSUNRFFileHeader AlienImage_SUNRFFileHeader;
//============================================================================
#ifndef _AlienImage_SUNRFFileHeader_HeaderFile
#define _AlienImage_SUNRFFileHeader_HeaderFile
//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_SUNRFFileHeader);
//============================================================================
#define RAS_MAGIC 0x59a66a95
/* Sun supported ras_type's */
#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */
#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */
#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */
#define RT_FORMAT_RGB 3 /* XRGB or RGB instead of XBGR or BGR */
#define RT_FORMAT_TIFF 4 /* tiff <-> standard rasterfile */
#define RT_FORMAT_IFF 5 /* iff (TAAC format) <-> standard rasterfile */
#define RT_EXPERIMENTAL 0xffff /* Reserved for testing */
/* Sun registered ras_maptype's */
#define RMT_RAW 2
/* Sun supported ras_maptype's */
#define RMT_NONE 0 /* ras_maplength is expected to be 0 */
#define RMT_EQUAL_RGB 1 /* red[ras_maplength/3],green[],blue[] */
/*
* NOTES:
* Each line of the image is rounded out to a multiple of 16 bits.
* This corresponds to the rounding convention used by the memory pixrect
* package (/usr/include/pixrect/memvar.h) of the SunWindows system.
* The ras_encoding field (always set to 0 by Sun's supported software)
* was renamed to ras_length in release 2.0. As a result, rasterfiles
* of type 0 generated by the old software claim to have 0 length; for
* compatibility, code reading rasterfiles must be prepared to compute the
* true length from the width, height, and depth fields.
*/
typedef struct {
int ras_magic; /* magic number */
int ras_width; /* width (pixels) of image */
int ras_height; /* height (pixels) of image */
int ras_depth; /* depth (1, 8, or 24 bits) of pixel */
int ras_length; /* length (bytes) of image */
int ras_type; /* type of file; see RT_* below */
int ras_maptype; /* type of colormap; see RMT_* below */
int ras_maplength; /* length (bytes) of following map */
/* color map follows for ras_maplength bytes, followed by image */
} AlienImage_SUNRFFileHeader;
ostream& operator << ( ostream& s, const AlienImage_SUNRFFileHeader& h );
Standard_Boolean operator==(const AlienImage_SUNRFFileHeader& Obj1,
const AlienImage_SUNRFFileHeader& Obj2) ;
void ShallowDump (const AlienImage_SUNRFFileHeader& AnObject,Standard_OStream& S) ;
#endif

View File

@@ -1,141 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class SunRFAlienData from AlienImage inherits AlienImageData from AlienImage
---Version: 0.0
---Level: Public
---Purpose: This class defines a SUN Raster File .rs Alien image.
---Keywords:
---Warning:
---References:
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
SUNRFFileHeader from AlienImage,
SUNRFFormat from AlienImage
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable SunRFAlienData from AlienImage ;
Clear( me : in out mutable ) ;
---Level: Public
---Purpose: Frees memory allocated by SunRFAlienData and
-- reset Object fields.
---C++: alias ~
FreeData( me : in out mutable ) ;
---Level: Public
---Purpose: Frees memory allocated by SunRFAlienData
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a SunRFAlienData object from a file .
-- Returns True if file is a Sun Raster file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a SunRFAlienData object to a file .
SetFormat( me : in out mutable ;
aFormat : SUNRFFormat from AlienImage);
---Level: Public
---Purpose: Set SUN Raster File Format for Write method.
Format( me : in immutable )
returns SUNRFFormat from AlienImage ;
---Level: Public
---Purpose: Get SUN Raster File Format .
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a SunRFAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a Image object to a SunRFAlienData object.
--
-- Private Method
--
ToPseudoColorImage( me : in immutable)
returns PseudoColorImage from Image is private ;
---Level: Internal
---Purpose : convert a AlienImage object to a Image object.
ToColorImage( me : in immutable)
returns ColorImage from Image is private ;
---Level: Internal
---Purpose : convert a AlienImage object to a Image object.
FromPseudoColorImage( me : in out mutable ;
anImage : in PseudoColorImage from Image );
---Level: Internal
---Purpose : convert a Image object to a SunRFAlienData object.
FromColorImage( me : in out mutable ;
anImage : in ColorImage from Image );
---Level: Internal
---Purpose : convert a Image object to a SunRFAlienData object.
ReadPixelRow( me : in out mutable ;
afile : in out File from OSD ;
aAddress : in Address from Standard ;
TheRowSize : in Integer from Standard )
returns Boolean from Standard;
---Level: Internal
---Purpose : Read a Image row from a file and store
-- TheRowSize byte at aAddress
-- returns True if Success.
WritePixelRow( me : in immutable ;
afile : in out File from OSD ;
aAddress : in Address from Standard ;
TheRowSize : in Integer from Standard )
returns Boolean from Standard;
---Level: Internal
---Purpose : Write a Image row to a file from TheRowSize byte at
-- aAddress
-- returns True if Success.
fields
myHeader : SUNRFFileHeader from AlienImage is protected ;
myDataSize : Integer from Standard ;
myData : Address from Standard is protected;
myRedData, myGreenData, myBlueData : Address from Standard is protected;
end ;

View File

@@ -1,722 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Aspect_GenericColorMap.hxx>
#include <Image_PseudoColorImage.hxx>
#include <AlienImage_MemoryOperations.hxx>
#include <AlienImage_SUNRFFormat.hxx>
#include <Image_Convertor.hxx>
#include <AlienImage_SunRFAlienData.ixx>
#include <Aspect_ColorMapEntry.hxx>
#include <Standard_Byte.hxx>
#include <Standard.hxx>
#ifdef TRACE
static int Verbose = 1 ;
#endif
#define RUN_FLAG 0x80
// Each line of the image is rounded out to a multiple of 16 bits
#define ROWBYTES() (((myHeader.ras_width*myHeader.ras_depth + 7 )/8 + 1 ) & ~1 )
AlienImage_SunRFAlienData::AlienImage_SunRFAlienData()
{ Clear() ; }
void AlienImage_SunRFAlienData::SetFormat(
const AlienImage_SUNRFFormat aFormat )
{ switch ( aFormat ) {
case AlienImage_SUNRF_Old :
myHeader.ras_type = RT_OLD ; break ;
case AlienImage_SUNRF_Standard :
myHeader.ras_type = RT_STANDARD ; break ;
case AlienImage_SUNRF_ByteEncoded :
myHeader.ras_type = RT_BYTE_ENCODED ; break ;
case AlienImage_SUNRF_RGB :
myHeader.ras_type = RT_FORMAT_RGB ; break ;
default :
cout << "SunRFAlienData : Unknown or Unsuported Format\n" ;
break ;
}
}
AlienImage_SUNRFFormat AlienImage_SunRFAlienData::Format() const
{ AlienImage_SUNRFFormat ret = AlienImage_SUNRF_Unknown ;
switch ( myHeader.ras_type ) {
case RT_OLD :
ret = AlienImage_SUNRF_Old ; break ;
case RT_STANDARD :
ret = AlienImage_SUNRF_Standard ; break ;
case RT_BYTE_ENCODED :
ret = AlienImage_SUNRF_ByteEncoded ; break ;
case RT_FORMAT_RGB :
ret = AlienImage_SUNRF_RGB ; break ;
}
return ret ;
}
void AlienImage_SunRFAlienData::FreeData()
{
if ( myData && myDataSize ) {
//Free all allocated memory
Standard::Free(myData) ;
myData = NULL ;
myDataSize = 0 ;
}
if ( myRedData && myHeader.ras_maplength ) {
//Free all allocated memory
Standard::Free( myRedData) ;
myRedData = NULL ;
}
if ( myGreenData && myHeader.ras_maplength ) {
//Free all allocated memory
Standard::Free(myGreenData) ;
myRedData = NULL ;
}
if ( myBlueData && myHeader.ras_maplength ) {
//Free all allocated memory
Standard::Free(myBlueData) ;
myRedData = NULL ;
}
}
void AlienImage_SunRFAlienData::Clear()
{ FreeData() ;
myHeader.ras_magic = RAS_MAGIC ;
myHeader.ras_width = 0 ;
myHeader.ras_height = 0 ;
myHeader.ras_length = 0 ;
myHeader.ras_type = RT_STANDARD ;
myHeader.ras_maptype = RMT_NONE ;
myHeader.ras_maplength = 0 ;
}
Standard_Boolean AlienImage_SunRFAlienData::Write( OSD_File& file ) const
{ Standard_Integer size;
AlienImage_SUNRFFileHeader TheHeader = myHeader ;
// Write out TheHeader information
if ( myData && myDataSize &&
myHeader.ras_type == RT_FORMAT_RGB &&
myHeader.ras_depth == 8 ) {
// Convert PseudoColorImage to TrueColor
Handle(Image_Image) aImage = ToImage() ;
if ( aImage->IsKind( STANDARD_TYPE(Image_PseudoColorImage) ) ) {
Image_Convertor Convertor;
Handle(Image_ColorImage) aCImage =
Convertor.Convert(Handle(Image_PseudoColorImage)::DownCast(aImage));
Handle(AlienImage_SunRFAlienData) newThis =
new AlienImage_SunRFAlienData() ;
newThis->FromImage( aCImage ) ;
newThis->SetFormat( AlienImage_SUNRF_RGB ) ;
return newThis->Write( file ) ;
}
}
size = ( Standard_Integer ) sizeof( TheHeader ) ;
const Standard_Address pHeader = ( Standard_Address ) &TheHeader ;
file.Write( pHeader, sizeof( TheHeader ) ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
// write out the color map buffer
if ( TheHeader.ras_maplength ) {
file.Write( myRedData, myHeader.ras_maplength/3 ) ;
file.Write( myGreenData, myHeader.ras_maplength/3 ) ;
file.Write( myBlueData, myHeader.ras_maplength/3 ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
Standard_Integer rwbytes ;
rwbytes = ROWBYTES() ;
if ( myData && myDataSize ) {
if ( myHeader.ras_type == RT_OLD ||
myHeader.ras_type == RT_STANDARD ||
myHeader.ras_type == RT_FORMAT_RGB ) {
if ( myHeader.ras_type == RT_FORMAT_RGB ) {
// Swap Sun Default BGR Format to RGB
Standard_Byte *p = ( Standard_Byte * )myData ;
Standard_Byte tmp, *pix ;
Standard_Integer j, i ;
if ( myHeader.ras_depth == 24 || myHeader.ras_depth == 32 ) {
for ( i = 0 ;i < myHeader.ras_height ; i++, p += rwbytes ) {
for ( j = 0, pix=p; j < myHeader.ras_width ; j++,pix+=3) {
if ( myHeader.ras_depth == 32 ) pix++ ;
tmp = *pix ;
*pix = *(pix+2) ;
*(pix+2) = tmp ;
}
}
}
else if ( myHeader.ras_depth == 8 ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
file.Write( myData, myDataSize ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
if ( myHeader.ras_type == RT_FORMAT_RGB &&
( myHeader.ras_depth == 24 || myHeader.ras_depth == 32 ) ) {
// Swap RGB Format to Sun Default
Standard_Byte *p = ( Standard_Byte * )myData ;
Standard_Byte tmp, *pix ;
Standard_Integer j, i ;
for ( i = 0 ;i < myHeader.ras_height ; i++, p += rwbytes ) {
for ( j = 0, pix=p; j < myHeader.ras_width ; j++,pix+=3) {
if ( myHeader.ras_depth == 32 ) pix++ ;
tmp = *pix ;
*pix = *(pix+2) ;
*(pix+2) = tmp ;
}
}
}
}
else if ( myHeader.ras_type == RT_BYTE_ENCODED ) {
Standard_Byte *p = ( Standard_Byte * )myData ;
Standard_Integer i ;
for ( i = 0 ; i < myHeader.ras_height ; i++, p += rwbytes ) {
if ( WritePixelRow( file, ( Standard_Address) p, rwbytes ) ==
Standard_False ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
}
}
return( Standard_True ) ;
}
Standard_Boolean AlienImage_SunRFAlienData::Read( OSD_File& file )
{ Standard_Integer bblcount, size ;
Standard_Address pheader = ( Standard_Address ) &myHeader ;
// Read in myHeader information
file.Read( pheader, sizeof( myHeader ), bblcount ) ;
if ( file.Failed() || ( bblcount != sizeof( myHeader ) ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
// check to see if the dump file is in the proper format */
if (myHeader.ras_magic != RAS_MAGIC) {
// ERROR "XWD file format version mismatch."
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
#ifdef TRACE
if ( Verbose ) cout << myHeader << endl << flush ;
#endif
// read in the color map buffer
if ( myHeader.ras_maplength ) {
size = myHeader.ras_maplength / 3 ;
myRedData = Standard::Allocate( size ) ;
myGreenData = Standard::Allocate( size ) ;
myBlueData = Standard::Allocate( size ) ;
file.Read( myRedData, size, bblcount ) ;
file.Read( myGreenData, size, bblcount ) ;
file.Read( myBlueData, size, bblcount ) ;
if ( file.Failed() || ( bblcount != size ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
#ifdef TRACE
if ( Verbose ) {
Standard_Byte *r = ( Standard_Byte * )myRedData ;
Standard_Byte *g = ( Standard_Byte * )myGreenData ;
Standard_Byte *b = ( Standard_Byte * )myBlueData ;
for (i = 0 ; i < myHeader.ncolors; i++,p++) {
cout << "(" << r << "," << g << "," << b << ")\n" << flush ;
}
}
#endif
}
if ( myHeader.ras_width && myHeader.ras_height && myHeader.ras_depth ) {
Standard_Integer rwbytes ;
rwbytes = ROWBYTES() ;
myDataSize = rwbytes * myHeader.ras_height ;
myData = Standard::Allocate( myDataSize ) ;
if ( myHeader.ras_type == RT_OLD ||
myHeader.ras_type == RT_STANDARD ||
myHeader.ras_type == RT_FORMAT_RGB ) {
file.Read( myData, myDataSize, bblcount ) ;
if ( file.Failed() || ( bblcount != myDataSize ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
if ( myHeader.ras_type == RT_FORMAT_RGB &&
( myHeader.ras_depth == 24 || myHeader.ras_depth == 32 )) {
// Swap RGB to Sun Default BGR Format
Standard_Byte *p = ( Standard_Byte * )myData ;
Standard_Byte tmp, *pix ;
Standard_Integer i, j ;
for ( i = 0 ; i < myHeader.ras_height ; i++, p += rwbytes ) {
for ( j = 0, pix = p; j < myHeader.ras_width ; j++,pix+=3) {
if ( myHeader.ras_depth == 32 ) pix++ ;
tmp = *pix ;
*pix = *(pix+2) ;
*(pix+2) = tmp ;
}
}
}
}
else if ( myHeader.ras_type == RT_BYTE_ENCODED ) {
Standard_Byte *p = ( Standard_Byte * )myData ;
Standard_Integer i ;
for ( i = 0 ; i < myHeader.ras_height ; i++, p += rwbytes ) {
if ( ReadPixelRow( file, ( Standard_Address) p, rwbytes ) ==
Standard_False ) {
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
}
}
return( Standard_True ) ;
}
Handle_Image_Image AlienImage_SunRFAlienData::ToImage() const
{ if ( myHeader.ras_depth <= 8 &&
myHeader.ras_maplength ) {
return( ToPseudoColorImage() ) ;
}
else if ( myHeader.ras_depth == 24 || myHeader.ras_depth == 32 ) {
return( ToColorImage() ) ;
}
else {
Standard_TypeMismatch_Raise_if( Standard_True,
"Attempt to convert a SunRFAlienData to a unknown Image_Image type");
return( NULL ) ;
}
}
void AlienImage_SunRFAlienData::FromImage( const Handle_Image_Image& anImage )
{ if ( anImage->Type() == Image_TOI_PseudoColorImage ) {
Handle(Image_PseudoColorImage) aPImage =
Handle(Image_PseudoColorImage)::DownCast(anImage) ;
FromPseudoColorImage( aPImage ) ;
}
else if ( anImage->Type() == Image_TOI_ColorImage ) {
Handle(Image_ColorImage) aCImage =
Handle(Image_ColorImage)::DownCast(anImage) ;
FromColorImage( aCImage ) ;
}
else {
Standard_TypeMismatch_Raise_if( Standard_True,
"Attempt to convert a unknown Image_Image type to a SunRFAlienData");
}
}
//------------------------------------------------------------------------------
// Private Method
//------------------------------------------------------------------------------
Standard_Boolean AlienImage_SunRFAlienData::ReadPixelRow(
OSD_File& file,
const Standard_Address pdata,
const Standard_Integer rwbytes)
{ Standard_Byte *p = ( Standard_Byte * )pdata ;
Standard_Byte byte, val ;
Standard_Integer RLEcnt, PixelCount, i, bblcount ;
Standard_Address pb = ( Standard_Address ) &byte ;
PixelCount = 0 ;
while ( PixelCount < myHeader.ras_width ) {
file.Read( pb, 1, bblcount ) ;
if ( file.Failed() || ( bblcount != 1 ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
if ( byte != RUN_FLAG ) {
// Get a single pixel byte
RLEcnt = 1 , val = byte ;
}
else { // RLE Flag
file.Read( pb, 1, bblcount ) ;
if ( file.Failed() || ( bblcount != 1 ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
if ( byte == 0 ) {
RLEcnt = 1 , val = RUN_FLAG ;
}
else {
RLEcnt = byte ;
file.Read( pb, 1, bblcount ) ;
if ( file.Failed() || ( bblcount != 1 ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
val = byte ;
}
for ( i = 0 ; i < RLEcnt ; i++, PixelCount++, p++ ) *p = val ;
}
}
return( Standard_True ) ;
}
Standard_Boolean AlienImage_SunRFAlienData::WritePixelRow(
OSD_File& file,
const Standard_Address pdata,
const Standard_Integer rwbytes ) const
{ Standard_Integer n, n1, n2 = 0;
Standard_Byte *scanln = ( Standard_Byte * ) pdata ;
Standard_Byte b ;
while ( n2 < rwbytes ) {
n1 = n2 ;
n2 = n1 + 1 ;
while( ( n2 < rwbytes ) && ( scanln[n1] == scanln[n2] ) ) n2++ ;
n = n2 - n1 ;
if ( n == 1 ) {
b = scanln[n1]; file.Write( ( Standard_Address ) &b, 1 ) ;
if ( scanln[n1] == RUN_FLAG ) {
b = 0 ; file.Write( ( Standard_Address ) &b, 1 ) ;
}
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
else {
while ( n > 256 ) {
b = RUN_FLAG ; file.Write( ( Standard_Address ) &b, 1) ;
b = 255 ; file.Write( ( Standard_Address ) &b, 1) ;
b = scanln[n1];file.Write( ( Standard_Address ) &b, 1) ;
n -= 256 ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
b = RUN_FLAG ; file.Write( ( Standard_Address ) &b, 1 ) ;
b = n-1 ; file.Write( ( Standard_Address ) &b, 1 ) ;
b = scanln[n1];file.Write( ( Standard_Address ) &b, 1 ) ;
}
}
return( Standard_True ) ;
}
void AlienImage_SunRFAlienData::FromPseudoColorImage(
const Handle(Image_PseudoColorImage)& TheImage)
{ Standard_Integer rowbytes,i ;
Standard_Integer x, y, pix;
Handle(Image_PseudoColorImage)anImage =
TheImage->Squeeze(Aspect_IndexPixel( 0 )) ;
Handle(Aspect_ColorMap) Cmap = anImage->ColorMap() ;
Aspect_ColorMapEntry aEntry ;
FreeData() ;
myHeader.ras_magic = RAS_MAGIC ;
myHeader.ras_width = anImage->Width() ;
myHeader.ras_height = anImage->Height() ;
myHeader.ras_depth = 8 ;
rowbytes = ROWBYTES() ;
myDataSize = myHeader.ras_height * rowbytes ;
myData = Standard::Allocate( myDataSize ) ;
myHeader.ras_length = myDataSize ;
myHeader.ras_maptype = RMT_EQUAL_RGB ;
myHeader.ras_maplength = Cmap->Size() ;
myRedData = Standard::Allocate( myHeader.ras_maplength ) ;
myGreenData = Standard::Allocate( myHeader.ras_maplength ) ;
myBlueData = Standard::Allocate( myHeader.ras_maplength ) ;
Standard_Byte *pr = ( Standard_Byte * ) myRedData ;
Standard_Byte *pg = ( Standard_Byte * ) myGreenData ;
Standard_Byte *pb = ( Standard_Byte * ) myBlueData ;
for ( i = 0 ; i < myHeader.ras_maplength ; i++, pr++, pg++, pb++ ) {
aEntry = Cmap->FindEntry( i ) ;
*pr = ( Standard_Byte ) ( aEntry.Color().Red() * 255. + 0.5 ) ;
*pg = ( Standard_Byte ) ( aEntry.Color().Green() * 255. + 0.5 ) ;
*pb = ( Standard_Byte ) ( aEntry.Color().Blue() * 255. + 0.5 ) ;
}
myHeader.ras_maplength *= 3 ;
if ( myData != NULL ) {
Standard_Byte *pr = ( Standard_Byte * ) myData ;
Standard_Byte *p ;
for ( y = 0 ; y < myHeader.ras_height ; y++, pr += rowbytes ) {
for ( x = 0, p = pr ; x < myHeader.ras_width ; x++ ) {
pix = anImage->Pixel( anImage->LowerX()+x ,
anImage->LowerY()+y ).Value() ;
*p = ( Standard_Byte ) pix ; p++ ;
}
}
}
}
void AlienImage_SunRFAlienData::FromColorImage(
const Handle_Image_ColorImage& anImage)
{ Standard_Integer rowbytes ;
Standard_Integer x, y;
Quantity_Color col ;
Standard_Real r,g,b ;
FreeData() ;
myHeader.ras_magic = RAS_MAGIC ;
myHeader.ras_width = anImage->Width() ;
myHeader.ras_height = anImage->Height() ;
myHeader.ras_depth = 24 ;
rowbytes = ROWBYTES() ;
myDataSize = myHeader.ras_height * rowbytes ;
myData = Standard::Allocate( myDataSize ) ;
myHeader.ras_length = myDataSize ;
myHeader.ras_maptype = RMT_NONE ;
myHeader.ras_maplength = 0 ;
if ( myData != NULL ) {
Standard_Byte *pr = ( Standard_Byte * ) myData ;
Standard_Byte *p ;
for ( y = 0 ; y < myHeader.ras_height ; y++, pr += rowbytes ) {
for ( x = 0, p = pr ; x < myHeader.ras_width ; x++ ) {
col = anImage->Pixel( anImage->LowerX()+x ,
anImage->LowerY()+y ).Value() ;
r = ( Standard_Integer ) ( col.Red() * 255. + 0.5 );
g = ( Standard_Integer ) ( col.Green() * 255. + 0.5 );
b = ( Standard_Integer ) ( col.Blue() * 255. + 0.5 );
*p = ( Standard_Byte ) b ; p++ ;
*p = ( Standard_Byte ) g ; p++ ;
*p = ( Standard_Byte ) r ; p++ ;
}
}
}
}
Handle_Image_ColorImage AlienImage_SunRFAlienData::ToColorImage() const
{ Aspect_ColorPixel CPixel ;
Quantity_Color acolor ;
Handle(Image_ColorImage) ret_image = NULL ;
Standard_Integer x,y, rowbytes ;
Standard_Real r,g,b ;
Standard_Byte *pr = ( Standard_Byte * ) myData ;
Standard_Byte *p ;
if ( myHeader.ras_depth == 24 || myHeader.ras_depth == 32 ) {
ret_image = new Image_ColorImage( 0,0,
(Standard_Integer)myHeader.ras_width,
(Standard_Integer)myHeader.ras_height ) ;
rowbytes = ROWBYTES() ;
for ( y = 0 ; y < myHeader.ras_height ; y++, pr += rowbytes ) {
for ( x = 0, p = pr ; x < myHeader.ras_width ; x++ ) {
if ( myHeader.ras_depth == 32 ) p++ ; // Skeep Alpha
b = ( Standard_Real ) *p / 255. ; p++ ;
g = ( Standard_Real ) *p / 255. ; p++ ;
r = ( Standard_Real ) *p / 255. ; p++ ;
acolor.SetValues( r,g,b, Quantity_TOC_RGB ) ;
CPixel.SetValue ( acolor ) ;
ret_image->SetPixel( ret_image->LowerX()+x ,
ret_image->LowerY()+y, CPixel ) ;
}
}
}
return( ret_image ) ;
}
Handle_Image_PseudoColorImage AlienImage_SunRFAlienData::ToPseudoColorImage()
const
{ Standard_Real r,g,b ;
Standard_Integer x, y ;
Handle(Image_PseudoColorImage) ret_image = NULL ;
if ( myHeader.ras_depth <= 8 &&
myHeader.ras_maplength ) {
Standard_Integer i,rowbytes ;
Aspect_ColorMapEntry Centry ;
Quantity_Color color ;
Aspect_IndexPixel IPixel ;
Standard_Byte *red = ( Standard_Byte * ) myRedData ;
Standard_Byte *green = ( Standard_Byte * ) myGreenData ;
Standard_Byte *blue = ( Standard_Byte * ) myBlueData ;
Standard_Byte *p ;
Standard_Byte *pr = ( Standard_Byte * ) myData ;
Handle(Aspect_GenericColorMap) colormap =
new Aspect_GenericColorMap();
for ( i = 0 ; i < myHeader.ras_maplength/3 ; i++, red++, green++, blue++ ) {
r = ( Standard_Real ) *red / 255. ;
g = ( Standard_Real ) *green / 255. ;
b = ( Standard_Real ) *blue / 255. ;
color.SetValues( r,g,b, Quantity_TOC_RGB );
Centry.SetValue( i, color ) ;
colormap->AddEntry( Centry ) ;
}
ret_image = new Image_PseudoColorImage( 0,0,
Standard_Integer(myHeader.ras_width),
Standard_Integer(myHeader.ras_height),
colormap ) ;
rowbytes = ROWBYTES() ;
for ( y = 0 ; y < myHeader.ras_height ; y++, pr += rowbytes ) {
for ( x = 0, p = pr ; x < myHeader.ras_width ; x++, p++ ) {
IPixel.SetValue( Standard_Integer( *p ) ) ;
ret_image->SetPixel( ret_image->LowerX()+x ,
ret_image->LowerY()+y, IPixel ) ;
}
}
}
return ret_image ;
}

View File

@@ -1,77 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: 02-06-98 : FMN ; Suppression appel Clear (deja fait dans ALienData)
class SunRFAlienImage from AlienImage inherits AlienUserImage from AlienImage
---Purpose: Defines a SunRF Alien image, i.e. an image using the
-- image format for SUN workstations.
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
SunRFAlienData from AlienImage,
SUNRFFormat from AlienImage
is
Create returns mutable SunRFAlienImage from AlienImage;
---Purpose: Constructs an empty SunRF alien image.
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by SunRFAlienImage
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : Converts a SunRFAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : Converts an Image object to a SunRFAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Reads the content of a SunRFAlienImage object from a file
-- Returns True if file is a XWD file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Purpose: Writes content of a SunRFAlienImage object to a file
SetFormat( me : in out mutable ;
aFormat : SUNRFFormat from AlienImage);
---Purpose: Sets the SUN Raster File Format for Write method.
Format( me : in immutable )
returns SUNRFFormat from AlienImage ;
---Purpose: Returns the SUN Raster File Format .
fields
myData : SunRFAlienData from AlienImage ;
end ;

View File

@@ -1,55 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_SunRFAlienImage.ixx>
AlienImage_SunRFAlienImage::AlienImage_SunRFAlienImage()
{ // il faut faire un new si mydata est du type HANDLE
myData = new AlienImage_SunRFAlienData() ;
}
void AlienImage_SunRFAlienImage::Clear()
{ myData->Clear() ; }
Standard_Boolean AlienImage_SunRFAlienImage::Write( OSD_File& file ) const
{ return( myData->Write( file ) ) ; }
Standard_Boolean AlienImage_SunRFAlienImage::Read( OSD_File& file )
{ return( myData->Read( file ) ) ; }
Handle_Image_Image AlienImage_SunRFAlienImage::ToImage() const
{ return( myData->ToImage() ) ; }
void AlienImage_SunRFAlienImage::FromImage( const Handle_Image_Image& anImage )
{ myData->FromImage( anImage ) ; }
void AlienImage_SunRFAlienImage::SetFormat(
const AlienImage_SUNRFFormat aFormat )
{ myData->SetFormat( aFormat ) ; }
AlienImage_SUNRFFormat AlienImage_SunRFAlienImage::Format() const
{ return myData->Format( ) ; }

View File

@@ -1,66 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_X11XColor.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_X11XColor)
{
static Handle(Standard_Type) _atype = new Standard_Type ("AlienImage_X11XColor", sizeof (AlienImage_X11XColor));
return _atype;
}
Standard_Boolean operator == ( const AlienImage_X11XColor& AnObject,
const AlienImage_X11XColor& AnotherObject )
{ Standard_Boolean _result = Standard_True;
_result = _result && (AnObject.pixel==AnotherObject.pixel) ;
_result = _result && (AnObject.red ==AnotherObject.red) ;
_result = _result && (AnObject.green==AnotherObject.green) ;
_result = _result && (AnObject.blue ==AnotherObject.blue) ;
_result = _result && (AnObject.flags==AnotherObject.flags) ;
return _result;
}
//============================================================================
//==== ShallowDump : Writes a CString value.
//============================================================================
void ShallowDump (const AlienImage_X11XColor& AnObject, Standard_OStream& s)
{
s << "AlienImage_X11XColor\n" ;
s << "\tpixel :" << AnObject.pixel << "\n";
s << "\tred/green/blue :" << AnObject.red << "/"
<< AnObject.green << "/"
<< AnObject.blue<< "\n";
s << "\tflags :" << AnObject.flags << "\n" << flush ;
}
ostream& operator << ( ostream& s, const AlienImage_X11XColor& c )
{
return( s << "(" << c.pixel
<< ",(" << c.red << ","
<< c.green <<","
<< c.blue
<< "),"
<< hex << c.flags
<< ")" ) ;
}

View File

@@ -1,63 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//============================================================================
//==== Titre: AlienImage_X11XColor.hxx
//==== Role : The header file of primitve type "X11XColor" from package
//==== "AlienImage"
//====
//==== Implementation: This is a primitive type implemented with typedef
//==== typedef XColor AlienImage_X11XColor;
//============================================================================
#ifndef AlienImage_X11XColor_HeaderFile
#define AlienImage_X11XColor_HeaderFile
/*
* Data structure used by color operations from <X11/Xlib.h>
*/
//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
extern const Handle_Standard_Type AlienImage_X11XColorType;
inline Handle(Standard_Type) AlienImage_X11XColorType_Type_() {return 0;}
//============================================================================
/*
invalide car unsigned long = 32 ou 64 !
#include <X11/Xlib.h>
typedef XColor AlienImage_X11XColor ;
*/
/*
* Data structure used by color operations
*/
typedef struct {
unsigned int pixel;
unsigned short red, green, blue;
char flags; /* do_red, do_green, do_blue */
char pad;
} AlienImage_X11XColor;
ostream& operator << ( ostream& s, const AlienImage_X11XColor& color );
Standard_Boolean operator == (const AlienImage_X11XColor& AnObject,
const AlienImage_X11XColor& AnotherObject);
void ShallowDump (const AlienImage_X11XColor& AnObject, Standard_OStream& S);
#endif

View File

@@ -1,154 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class X11XWDAlienData from AlienImage inherits AlienImageData from AlienImage
---Version: 0.0
---Purpose: This class defines a X11 Alien image.
---Keywords:
---Warning:
---References:
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
X11XColor from AlienImage,
X11XWDFileHeader from AlienImage
raises
OutOfRange from Standard,
TypeMismatch from Standard
is
Create returns mutable X11XWDAlienData from AlienImage ;
Clear( me : in out mutable ) ;
---Level: Public
---Purpose: Frees memory allocated by X11XWDAlienData
---C++: alias ~
Read ( me : in out mutable ; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Read content of a X11XWDAlienData object from a file
-- Returns True if file is a XWD file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Write content of a X11XWDAlienData object to a file
SetName( me : in out mutable ;
aName : in AsciiString from TCollection)
is redefined;
---Level: Public
---Purpose: Set Image name .
Name( me : in immutable ) returns AsciiString from TCollection
is redefined;
---C++: return const &
---Level: Public
---Purpose: Get Image name .
ToImage( me : in immutable)
returns mutable Image from Image
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a X11XWDAlienData object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image )
raises TypeMismatch from Standard ;
---Level: Public
---Purpose : convert a Image object to a X11XWDAlienData object.
--
-- Private Method
--
Pixel ( me : in immutable ; X,Y : in Integer from Standard )
returns Integer from Standard
raises OutOfRange from Standard is private ;
---Level: Internal
SetPixel( me : in out mutable; X,Y : in Integer from Standard ;
Value : in Integer from Standard )
raises OutOfRange from Standard is private ;
---Level: Internal
DataSize( me : in immutable)
returns Integer from Standard is private ;
---Level: Internal
---Purpose: Compute the imaga data size in byte
-- from header information
RedShift( me : in immutable) returns Integer from Standard
raises TypeMismatch from Standard is private ;
---Purpose: Compute the red shift for TrueColor X11XWDImage
GreenShift( me : in immutable) returns Integer from Standard
raises TypeMismatch from Standard is private ;
---Level: Internal
---Purpose: Compute the red shift for TrueColor X11XWDImage
BlueShift( me : in immutable) returns Integer from Standard
raises TypeMismatch from Standard is private ;
---Level: Internal
---Purpose: Compute the red shift for TrueColor X11XWDImage
ToPseudoColorImage( me : in immutable)
returns PseudoColorImage from Image is private ;
---Level: Internal
---Purpose : convert a Image object to a AlienImage object.
ToColorImage( me : in immutable)
returns ColorImage from Image is private ;
---Level: Internal
---Purpose : convert a Image object to a AlienImage object.
FromPseudoColorImage( me : in out mutable;
anImage : in PseudoColorImage from Image )
is private ;
---Level: Internal
---Purpose : convert a Image object to a X11XWDAlienData object.
FromColorImage( me : in out mutable;
anImage : in ColorImage from Image)
is private ;
---Level: Internal
---Purpose : convert a Image object to a X11XWDAlienData object.
fields
myHeader : X11XWDFileHeader from AlienImage is protected ;
myColors : Address from Standard is protected ;
-- XColors definition
myData : Address from Standard is protected ;
-- my is a ( unsigned char * ) for 8 bit image ,
-- ( unsigned int * ) for 24 bit image .
end ;

View File

@@ -1,841 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#define PRO9517 //GG_010997
// 1) Le swap ne fonctionne pas correctement sur DEC
// car X11XColor.pixel est int et non long (::Read(),::Write()).
// 2) Initialiser la table des couleurs avant d'ecrire
// le fichier temporaire (::Write())
#define K4 //GG_110398
// Ne pas initialiser una AsciiString avec '\0' dans le
// constructeur de AlienImage_X11XWDAlienData sinon RAISE !
#define TEST //GG_140699
// Check file extension, must be ".xwd".
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
# include <X11/Xlib.h>
#endif // WNT
#include <Aspect_GenericColorMap.hxx>
#include <Image_PseudoColorImage.hxx>
#include <AlienImage_MemoryOperations.hxx>
#include <AlienImage_X11XColor.hxx>
#include <AlienImage_X11XWDAlienData.ixx>
#include <Aspect_ColorMapEntry.hxx>
#include <Standard.hxx>
#ifdef TRACE
static int Verbose = 0 ;
#endif
AlienImage_X11XWDAlienData::AlienImage_X11XWDAlienData()
{ myData = NULL ;
myColors = NULL ;
}
void AlienImage_X11XWDAlienData::SetName( const TCollection_AsciiString& aName)
{ myName = aName + TCollection_AsciiString( "\0" ) ;
myHeader.header_size = sizeof( myHeader ) + myName.Length() ;
}
const TCollection_AsciiString& AlienImage_X11XWDAlienData::Name() const
{ return ( myName ) ; }
void AlienImage_X11XWDAlienData::Clear()
{ Standard_Integer size ;
myHeader.header_size = sizeof( myHeader ) ;
/* Size of the entire file header (bytes).*/
myHeader.file_version = 0 ; /* XWD_FILE_VERSION */
myHeader.pixmap_format= 0; /* Pixmap format */
myHeader.pixmap_depth = 0 ; /* Pixmap depth */
myHeader.pixmap_width = 0 ; /* Pixmap width */
myHeader.pixmap_height= 0 ; /* Pixmap height */
myHeader.xoffset = 0 ; /* Bitmap x offset */
myHeader.byte_order = 0; /* MSBFirst, LSBFirst */
myHeader.bitmap_unit = 0 ; /* Bitmap unit */
myHeader.bitmap_bit_order = 0; /* MSBFirst, LSBFirst */
myHeader.bitmap_pad = 0 ; /* Bitmap scanline pad */
myHeader.bits_per_pixel = 0 ; /* Bits per pixel */
myHeader.bytes_per_line =0 ; /* Bytes per scanline */
myHeader.visual_class = 0 ; /* Class of colormap */
myHeader.red_mask = 0 ; /* Z red mask */
myHeader.green_mask = 0 ; /* Z green mask */
myHeader.blue_mask = 0 ; /* Z blue mask */
myHeader.bits_per_rgb = 0 ; /* Log2 of distinct color values */
myHeader.colormap_entries = 0 ; /* Number of entries in colormap */
myHeader.ncolors = 0 ; /* Number of Color structures */
myHeader.window_width = 0 ; /* Window width */
myHeader.window_height= 0 ; /* Window height */
myHeader.window_x = 0 ; /* Window upper left X coordinate */
myHeader.window_y = 0 ; /* Window upper left Y coordinate */
myHeader.window_bdrwidth =0 ; /* Window border width */
myName.Clear() ;
if ( myData ) {
//Free all allocated memory
Standard::Free(myData) ;
myData = NULL ;
}
if ( myColors ) {
size = ( Standard_Integer )
myHeader.ncolors * sizeof( AlienImage_X11XColor ) ;
//Free all allocated memory
Standard::Free(myColors);
myColors = NULL ;
}
}
Standard_Boolean AlienImage_X11XWDAlienData::Write( OSD_File& file ) const
{ Standard_Integer size, i ;
unsigned long swaptest = 1;
AlienImage_X11XWDFileHeader TheHeader = myHeader ;
if ( myData == NULL ) return( Standard_False ) ;
if ( TheHeader.ncolors &&
myColors == NULL ) return( Standard_False ) ;
// Write out TheHeader information
size = ( Standard_Integer ) TheHeader.header_size - sizeof( TheHeader ) ;
if ( size ) {
// Add '\0' at the end of name
TheHeader.header_size++ ;
}
if (*(char *) &swaptest) {
AlienImage_X11XWDFileHeader SwapHeader = TheHeader ;
AlienImage_MemoryOperations::SwapLong( ( Standard_Address ) &SwapHeader,
sizeof(SwapHeader));
file.Write( &SwapHeader , sizeof( SwapHeader ) ) ;
}
else {
const Standard_Address pHeader = ( Standard_Address ) &TheHeader ;
file.Write( pHeader, sizeof( TheHeader ) ) ;
}
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
size = ( Standard_Integer ) TheHeader.header_size - sizeof( TheHeader ) ;
if ( size ) {
char end = '\0' ;
Standard_Address pend = Standard_Address( &end ) ;
file.Write( myName, myName.Length() ) ;
file.Write( pend, 1 ) ;
}
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
// write out the color map buffer
if ( TheHeader.ncolors ) {
size = ( Standard_Integer ) TheHeader.ncolors
* sizeof( AlienImage_X11XColor ) ;
if (*(char *) &swaptest) {
Standard_Address palloc =
Standard::Allocate( size ) ;
#ifdef PRO9517
const AlienImage_X11XColor *p = ( AlienImage_X11XColor * ) myColors ;
AlienImage_X11XColor *pp = ( AlienImage_X11XColor * ) palloc ;
for (i = 0 ; (unsigned int ) i < TheHeader.ncolors; i++,p++,pp++) {
pp->pixel = p->pixel;
pp->red = p->red;
pp->green = p->green;
pp->blue = p->blue;
pp->flags = p->flags;
AlienImage_MemoryOperations::SwapLong (
(Standard_Address) &(pp->pixel), sizeof(int));
AlienImage_MemoryOperations::SwapShort(
(Standard_Address) &(pp->red) , 3 * sizeof(short));
}
#else
const AlienImage_X11XColor *p = ( AlienImage_X11XColor * ) palloc ;
for (i = 0 ; i < TheHeader.ncolors; i++,p++) {
AlienImage_MemoryOperations::SwapLong (
(Standard_Address) &(p->pixel), sizeof(long));
AlienImage_MemoryOperations::SwapShort(
(Standard_Address) &(p->red) , 3 * sizeof(short));
}
#endif
file.Write( palloc, size ) ;
//Free all allocated memory
Standard::Free(palloc) ;
}
else {
file.Write( myColors, size ) ;
}
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
if ( DataSize() ) {
file.Write( myData, DataSize() ) ;
if ( file.Failed() ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
return( Standard_True ) ;
}
Standard_Boolean AlienImage_X11XWDAlienData::Read( OSD_File& file )
{ Standard_Integer bblcount, i, size ;
unsigned long swaptest = 1;
Standard_Address pheader = ( Standard_Address ) &myHeader ;
#ifdef TEST
OSD_Path path; file.Path(path);
TCollection_AsciiString ext = path.Extension(); ext.LowerCase();
if( ext != ".xwd" ) {
TCollection_AsciiString sysname; path.SystemName(sysname);
#ifdef TRACE
cout << " *** AlienImage_X11XWDAlienData::Read('" << sysname << "'). must have an '.xwd' extension" << endl;
#endif
return Standard_False;
}
#endif
// Read in myHeader information
file.Read( pheader, sizeof( myHeader ), bblcount ) ;
if ( file.Failed() || ( bblcount != sizeof( myHeader ) ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
if (*(char *) &swaptest)
AlienImage_MemoryOperations::SwapLong( ( Standard_Address ) &myHeader,
sizeof(myHeader));
// check to see if the dump file is in the proper format */
if (myHeader.file_version != XWD_FILE_VERSION) {
// ERROR "XWD file format version mismatch."
if (*(char *) &swaptest)
AlienImage_MemoryOperations::SwapLong( ( Standard_Address ) &myHeader,
sizeof(myHeader));
if (myHeader.file_version != XWD_FILE_VERSION) {
// ERROR "XWD file format version mismatch."
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
else {
// Data come from a swaped computer ??
swaptest = 0 ;
}
}
if (myHeader.header_size < sizeof(myHeader)) {
// ERROR "XWD header size is too small."
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
#ifdef TRACE
if ( Verbose ) cout << myHeader << endl << flush ;
#endif
// read in window name
size = ( Standard_Integer ) myHeader.header_size - sizeof( myHeader ) ;
if ( size > 0 ) {
#ifdef K4
TCollection_AsciiString name( bblcount ) ;
#else
TCollection_AsciiString name( bblcount , '\0') ;
#endif
file.Read( name, size ) ; bblcount = name.Length() ;
#ifdef WNT
--size;
#endif // WNT
if ( file.Failed() || ( bblcount != size ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
myName = name ;
#ifdef TRACE
if ( Verbose ) cout << myName << endl << flush ;
#endif
}
// read in the color map buffer
if ( myHeader.ncolors ) {
size = ( Standard_Integer ) myHeader.ncolors
* sizeof( AlienImage_X11XColor ) ;
myColors = Standard::Allocate( size ) ;
file.Read( myColors, size, bblcount ) ;
if ( file.Failed() || ( bblcount != size ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
if ( *(char *) &swaptest ) {
AlienImage_X11XColor *p
= ( AlienImage_X11XColor * )myColors ;
for (i = 0 ; (unsigned int ) i < myHeader.ncolors; i++,p++) {
#ifdef PRO9517
AlienImage_MemoryOperations::SwapLong (
(Standard_Address) &(p->pixel), sizeof(int));
#else
AlienImage_MemoryOperations::SwapLong (
(Standard_Address) &(p->pixel), sizeof(long));
#endif
AlienImage_MemoryOperations::SwapShort(
(Standard_Address) &(p->red) , 3 * sizeof(short));
}
}
#ifdef TRACE
if ( Verbose ) {
AlienImage_X11XColor *p = ( AlienImage_X11XColor * )myColors;
for (i = 0 ; i < myHeader.ncolors; i++,p++) {
cout << *p << endl << flush ;
}
}
#endif
}
if ( DataSize() ) {
myData = Standard::Allocate( DataSize() ) ;
file.Read( myData, DataSize(), bblcount ) ;
if ( file.Failed() || ( bblcount != DataSize() ) ) {
// ERROR
file.Seek( 0, OSD_FromBeginning ) ;
return( Standard_False ) ;
}
}
return( Standard_True ) ;
}
Handle_Image_Image AlienImage_X11XWDAlienData::ToImage() const
{ if ( myHeader.pixmap_depth <= 8 &&
myHeader.ncolors &&
myHeader.pixmap_format == ZPixmap) {
return( ToPseudoColorImage() ) ;
}
else if ( myHeader.visual_class == TrueColor &&
myHeader.pixmap_format == ZPixmap) {
return( ToColorImage() ) ;
}
else {
Standard_TypeMismatch_Raise_if( Standard_True,
"Attempt to convert a X11XWDAlienData to a unknown Image_Image type");
return( NULL ) ;
}
}
void AlienImage_X11XWDAlienData::FromImage( const Handle_Image_Image& anImage )
{ if ( anImage->Type() == Image_TOI_PseudoColorImage ) {
Handle(Image_PseudoColorImage) aPImage =
Handle(Image_PseudoColorImage)::DownCast(anImage) ;
FromPseudoColorImage( aPImage ) ;
}
else if ( anImage->Type() == Image_TOI_ColorImage ) {
Handle(Image_ColorImage) aCImage =
Handle(Image_ColorImage)::DownCast(anImage) ;
FromColorImage( aCImage ) ;
}
else {
Standard_TypeMismatch_Raise_if( Standard_True,
"Attempt to convert a unknown Image_Image type to a X11XWDAlienData");
}
}
//------------------------------------------------------------------------------
// Private Method
//------------------------------------------------------------------------------
void AlienImage_X11XWDAlienData::FromPseudoColorImage(
const Handle_Image_PseudoColorImage& anImage)
{ Standard_Integer size, i ;
/* Size of the entire file header (bytes).*/
myHeader.header_size = sizeof(myHeader) + myName.Length() ;
myHeader.file_version = XWD_FILE_VERSION ; /* XWD_FILE_VERSION */
myHeader.pixmap_format = ZPixmap ; /* Pixmap format */
myHeader.pixmap_depth = 8 ; /* Pixmap depth */
myHeader.pixmap_width = anImage->Width() ;/* Pixmap width */
myHeader.pixmap_height = anImage->Height() ;/* Pixmap height */
myHeader.xoffset = 0 ; /* Bitmap x offset */
myHeader.byte_order = MSBFirst; /* MSBFirst, LSBFirst */
myHeader.bitmap_unit = 32 ; /* Bitmap unit */
myHeader.bitmap_bit_order = MSBFirst; /* MSBFirst, LSBFirst */
myHeader.bitmap_pad = 32 ; /* Bitmap scanline pad */
myHeader.bits_per_pixel = 8 ; /* Bits per pixel */
/* Bytes per scanline */
size = ( Standard_Integer ) ( anImage->Width() * myHeader.bits_per_pixel );
myHeader.bytes_per_line = size / myHeader.bitmap_unit ;
if ( size % myHeader.bitmap_pad ) myHeader.bytes_per_line += 1 ;
myHeader.bytes_per_line *= ( myHeader.bitmap_unit / 8 ) ;
myHeader.visual_class = PseudoColor ; /* Class of colormap */
myHeader.red_mask = 0 ; /* Z red mask */
myHeader.green_mask = 0 ; /* Z green mask */
myHeader.blue_mask = 0 ; /* Z blue mask */
myHeader.bits_per_rgb = 8 ; /* Log2 of distinct color values */
myHeader.colormap_entries = 256 ; /* Number of entries in colormap */
myHeader.ncolors = (anImage->ColorMap())->Size() ;
/* Number of Color structures */
myHeader.window_width = anImage->Width() ; /* Window width */
myHeader.window_height = anImage->Height() ; /* Window height */
myHeader.window_x = 0 ; /* Window upper left X coordinate */
myHeader.window_y = 0 ; /* Window upper left Y coordinate */
myHeader.window_bdrwidth = 0 ; /* Window border width */
size = ( Standard_Integer ) myHeader.ncolors
* sizeof( AlienImage_X11XColor ) ;
myColors = Standard::Allocate( size ) ;
AlienImage_X11XColor *p = ( AlienImage_X11XColor * )myColors ;
Aspect_ColorMapEntry aCentry ;
for ( i = 1 ; (unsigned int ) i <= myHeader.ncolors ; i++, p++ ) {
p->pixel = 0 ;
p->red = p->green = p->blue = 0 ;
p->flags = 0 ;
aCentry = (anImage->ColorMap())->Entry( i ) ;
if ( aCentry.IsAllocated() == Standard_True ) {
p->flags = DoRed | DoGreen | DoBlue ;
p->pixel = aCentry.Index() ;
p->red = ( unsigned short )
( (aCentry.Color()).Red() * 0xffff + 0.5 ) ;
p->green = ( unsigned short )
( (aCentry.Color()).Green() * 0xffff + 0.5 ) ;
p->blue = ( unsigned short )
( (aCentry.Color()).Blue() * 0xffff + 0.5 ) ;
}
}
if ( anImage->Size() ) {
Standard_Integer x, y ;
myData = Standard::Allocate( DataSize() ) ;
for ( y = 0 ; (unsigned int ) y < myHeader.pixmap_height ; y++ ) {
for ( x = 0 ; (unsigned int ) x < myHeader.pixmap_width ; x++ ) {
SetPixel( x, y,
( anImage->Pixel( anImage->LowerX()+x ,
anImage->LowerY()+y )).Value() ) ;
}
}
}
}
void AlienImage_X11XWDAlienData::FromColorImage(
const Handle_Image_ColorImage& anImage)
{ long int size ;;
/* Size of the entire file header (bytes).*/
myHeader.header_size = sizeof(myHeader) + myName.Length() ;
myHeader.file_version = XWD_FILE_VERSION ; /* XWD_FILE_VERSION */
myHeader.pixmap_format = ZPixmap ; /* Pixmap format */
myHeader.pixmap_depth = 24 ; /* Pixmap depth */
myHeader.pixmap_width = anImage->Width() ;/* Pixmap width */
myHeader.pixmap_height = anImage->Height() ;/* Pixmap height */
myHeader.xoffset = 0 ; /* Bitmap x offset */
myHeader.byte_order = MSBFirst; /* MSBFirst, LSBFirst */
myHeader.bitmap_unit = 32 ; /* Bitmap unit */
myHeader.bitmap_bit_order = MSBFirst; /* MSBFirst, LSBFirst */
myHeader.bitmap_pad = 32 ; /* Bitmap scanline pad */
myHeader.bits_per_pixel = 32 ; /* Bits per pixel */
/* Bytes per scanline */
size = anImage->Width() * myHeader.bits_per_pixel ;
myHeader.bytes_per_line = size / myHeader.bitmap_unit ;
if ( size % myHeader.bitmap_pad ) myHeader.bytes_per_line += 1 ;
myHeader.bytes_per_line *= ( myHeader.bitmap_unit / 8 ) ;
myHeader.visual_class = TrueColor ; /* Class of colormap */
myHeader.red_mask = 0xff ; /* Z red mask */
myHeader.green_mask = 0xff00 ; /* Z green mask */
myHeader.blue_mask = 0xff0000 ; /* Z blue mask */
myHeader.bits_per_rgb = 8 ; /* Log2 of distinct color values */
myHeader.colormap_entries = 256 ; /* Number of entries in colormap */
myHeader.ncolors = 0 ; /* Number of Color structures */
myHeader.window_width = anImage->Width() ; /* Window width */
myHeader.window_height = anImage->Height() ; /* Window height */
myHeader.window_x = 0 ; /* Window upper left X coordinate */
myHeader.window_y = 0 ; /* Window upper left Y coordinate */
myHeader.window_bdrwidth = 0 ; /* Window border width */
myColors = NULL ;
if ( anImage->Size() ) {
Standard_Integer x, y, pix, c ;
const Standard_Integer rs = RedShift() ;
const Standard_Integer gs = GreenShift() ;
const Standard_Integer bs = BlueShift() ;
const Standard_Integer ColorRange =
Standard_Integer( ( 1 << myHeader.bits_per_rgb ) - 1 );
Quantity_Color col ;
myData = Standard::Allocate( DataSize() ) ;
for ( y = 0 ; (unsigned int ) y < myHeader.pixmap_height ; y++ ) {
for ( x = 0 ; (unsigned int ) x < myHeader.pixmap_width ; x++ ) {
col = anImage->Pixel( anImage->LowerX()+x ,
anImage->LowerY()+y ).Value() ;
pix = 0 ;
c = ( Standard_Integer ) ( col.Red() * ColorRange + 0.5 );
c = ( Standard_Integer ) (( c << rs ) & myHeader.red_mask) ;
pix |= c ;
c = ( Standard_Integer ) ( col.Green() * ColorRange + 0.5 );
c = ( Standard_Integer ) (( c << gs ) & myHeader.green_mask) ;
pix |= c ;
c = ( Standard_Integer ) ( col.Blue() * ColorRange + 0.5 );
c = ( Standard_Integer ) (( c << bs ) & myHeader.blue_mask) ;
pix |= c ;
SetPixel( x, y, pix ) ;
}
}
}
}
Handle_Image_ColorImage AlienImage_X11XWDAlienData::ToColorImage() const
{ Aspect_ColorPixel CPixel ;
Quantity_Color acolor ;
Handle(Image_ColorImage) ret_image = NULL ;
Standard_Integer pix,x,y ;
Standard_Real r,g,b, maxcol ;
if ( myHeader.visual_class == TrueColor &&
myHeader.pixmap_format == ZPixmap) {
ret_image = new Image_ColorImage( 0,0,
(Standard_Integer)myHeader.pixmap_width,
(Standard_Integer)myHeader.pixmap_height ) ;
maxcol = ( 1 << myHeader.bits_per_rgb ) - 1 ;
for ( y = 0 ; (unsigned int ) y < myHeader.pixmap_height ; y++ ) {
for ( x = 0 ; (unsigned int ) x < myHeader.pixmap_width ; x++ ) {
pix = Pixel( x, y ) ;
r = ( ( pix & myHeader.red_mask ) >> RedShift() ) / maxcol ;
g = ( ( pix & myHeader.green_mask ) >> GreenShift() ) / maxcol ;
b = ( ( pix & myHeader.blue_mask ) >> BlueShift() ) / maxcol ;
acolor.SetValues( r,g,b, Quantity_TOC_RGB ) ;
CPixel.SetValue ( acolor ) ;
ret_image->SetPixel( ret_image->LowerX()+x ,
ret_image->LowerY()+y, CPixel ) ;
}
}
}
return( ret_image ) ;
}
Handle_Image_PseudoColorImage AlienImage_X11XWDAlienData::ToPseudoColorImage()
const
{ Standard_Real r,g,b ;
Standard_Integer x, y ;
const Standard_Real XRange = Standard_Real( Standard_Integer(0xffff) );
const Standard_Integer newColorSize =
Standard_Integer(myHeader.colormap_entries*sizeof(AlienImage_X11XColor));
Handle(Image_PseudoColorImage) ret_image = NULL ;
if ( myHeader.pixmap_depth <= 8 &&
myHeader.ncolors &&
myHeader.pixmap_format == ZPixmap) {
// unsigned long int i, j, ncol ;
unsigned long int i, ncol ;
Aspect_ColorMapEntry Centry ;
Quantity_Color color ;
AlienImage_X11XColor *p ;
AlienImage_X11XColor *newColor ;
Standard_Address palloc ;
Aspect_IndexPixel IPixel ;
palloc = Standard::Allocate( newColorSize ) ;
newColor = ( AlienImage_X11XColor * ) palloc ;
p = ( AlienImage_X11XColor * )myColors;
for ( i = 0 ; i < myHeader.ncolors ; i++, p++ ) newColor[p->pixel] = *p;
for ( i = 0 ; i < myHeader.colormap_entries ; i++ ) newColor[i].flags = 0 ;
for ( y = 0 ; (unsigned int ) y < myHeader.pixmap_height ; y++ ) {
for ( x = 0 ; (unsigned int ) x < myHeader.pixmap_width ; x++ ) {
newColor[ Pixel( x, y ) ].flags = DoRed | DoGreen | DoBlue ;
}
}
for ( i = ncol = 0 ; i < myHeader.colormap_entries ; i++ ) {
if ( newColor[i].flags ) ncol++ ;
}
Handle(Aspect_GenericColorMap) colormap =
new Aspect_GenericColorMap();
for ( i = 0 ; i < myHeader.colormap_entries ; i++ ) {
if ( newColor[i].flags ) {
r = ( Standard_Real ) newColor[i].red / XRange ;
g = ( Standard_Real ) newColor[i].green / XRange ;
b = ( Standard_Real ) newColor[i].blue / XRange ;
color.SetValues( r,g,b, Quantity_TOC_RGB );
Centry.SetValue( Standard_Integer(newColor[i].pixel), color ) ;
colormap->AddEntry( Centry ) ;
}
}
ret_image = new Image_PseudoColorImage( 0,0,
Standard_Integer(myHeader.pixmap_width),
Standard_Integer(myHeader.pixmap_height),
colormap ) ;
for ( y = 0 ; (unsigned int ) y < myHeader.pixmap_height ; y++ ) {
for ( x = 0 ; (unsigned int ) x < myHeader.pixmap_width ; x++ ) {
IPixel.SetValue( Pixel( x, y ) ) ;
ret_image->SetPixel( ret_image->LowerX()+x ,
ret_image->LowerY()+y, IPixel ) ;
}
}
//Free all allocated memory
Standard::Free(palloc);
}
return ret_image ;
}
Standard_Integer AlienImage_X11XWDAlienData::DataSize() const
{
if ( myHeader.pixmap_format != ZPixmap)
return( myHeader.bytes_per_line * myHeader.pixmap_height
* myHeader.pixmap_depth );
return( myHeader.bytes_per_line * myHeader.pixmap_height);
}
void AlienImage_X11XWDAlienData::SetPixel(
const Standard_Integer x,
const Standard_Integer y,
const Standard_Integer value )
{ unsigned char *p ;
unsigned long int pixel_size ;
Standard_OutOfRange_Raise_if(
( x < 0 || (unsigned int ) x >= myHeader.pixmap_width ||
y < 0 || (unsigned int ) y >= myHeader.pixmap_height ),
"Index out of range in X11XWDAlienData::Pixel");
pixel_size = ( unsigned long int ) myHeader.bytes_per_line /
myHeader.pixmap_width;
p = ( unsigned char * ) myData ;
p += y * myHeader.bytes_per_line + x * pixel_size ;
if ( pixel_size == 1 ) {
*p = ( unsigned char ) value ;
}
else if ( pixel_size == 2 ) {
*( ( unsigned short int * ) p ) = ( unsigned short int ) value ;
}
else if ( pixel_size == 4 ) {
*( ( unsigned long int * ) p ) = ( unsigned long int ) value ;
}
}
Standard_Integer AlienImage_X11XWDAlienData::Pixel(
const Standard_Integer x, const Standard_Integer y ) const
{ unsigned char *p ;
unsigned long int pixel_size ;
unsigned long int pix ;
Standard_Integer ret ;
Standard_OutOfRange_Raise_if(
( x < 0 || (unsigned int ) x >= myHeader.pixmap_width ||
y < 0 || (unsigned int ) y >= myHeader.pixmap_height ),
"Index out of range in X11XWDAlienData::Pixel");
pixel_size = ( unsigned long int ) myHeader.bytes_per_line /
myHeader.pixmap_width;
p = ( unsigned char * ) myData ;
p += y * myHeader.bytes_per_line + x * pixel_size ;
if ( pixel_size == 1 ) {
pix = ( unsigned long int ) *p ;
}
else if ( pixel_size == 2 ) {
pix = *( ( unsigned short int * ) p ) ;
}
else {
pix = *( ( unsigned long int * ) p ) ;
}
ret = Standard_Integer ( pix );
return( ret ) ;
}
Standard_Integer AlienImage_X11XWDAlienData::RedShift() const
{ Standard_Integer shift = 0 ;
Standard_TypeMismatch_Raise_if( myHeader.visual_class != TrueColor ,
"Attempt to get RedShift from a non TrueColor X11XWDImage" ) ;
if ( ( myHeader.red_mask >> myHeader.bits_per_rgb ) == 0 ) {
shift = 0 ;
}
else if ( ( myHeader.red_mask >> ( 2 * myHeader.bits_per_rgb ) ) == 0 ) {
shift = Standard_Integer( myHeader.bits_per_rgb ) ;
}
else {
shift = Standard_Integer( 2 * myHeader.bits_per_rgb );
}
return shift ;
}
Standard_Integer AlienImage_X11XWDAlienData::GreenShift() const
{ Standard_Integer shift = 0 ;
Standard_TypeMismatch_Raise_if( myHeader.visual_class != TrueColor ,
"Attempt to get GreenShift from a non TrueColor X11XWDImage" ) ;
if ( ( myHeader.green_mask >> myHeader.bits_per_rgb ) == 0 ) {
shift = 0 ;
}
else if ( ( myHeader.green_mask >> ( 2 * myHeader.bits_per_rgb ) ) == 0 ) {
shift = Standard_Integer( myHeader.bits_per_rgb ) ;
}
else {
shift = Standard_Integer( 2 * myHeader.bits_per_rgb ) ;
}
return shift ;
}
Standard_Integer AlienImage_X11XWDAlienData::BlueShift() const
{ Standard_Integer shift = 0 ;
Standard_TypeMismatch_Raise_if( myHeader.visual_class != TrueColor ,
"Attempt to get BlueShift from a non TrueColor X11XWDImage" ) ;
if ( ( myHeader.blue_mask >> myHeader.bits_per_rgb ) == 0 ) {
shift = 0 ;
}
else if ( ( myHeader.blue_mask >> ( 2 * myHeader.bits_per_rgb ) ) == 0 ) {
shift = Standard_Integer( myHeader.bits_per_rgb ) ;
}
else {
shift = Standard_Integer( 2 * myHeader.bits_per_rgb ) ;
}
return shift ;
}

View File

@@ -1,152 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
# include <X11/Xlib.h>
#endif // WNT
#include <AlienImage_X11XWDFileHeader.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_X11XWDFileHeader)
{
static Handle(Standard_Type) _atype =
new Standard_Type ("AlienImage_X11XWDFileHeader", sizeof (AlienImage_X11XWDFileHeader));
return _atype;
}
Standard_Boolean operator == (
const AlienImage_X11XWDFileHeader& AnObject,
const AlienImage_X11XWDFileHeader& AnotherObject)
{ Standard_Boolean _result = Standard_True;
_result = _result && (AnObject.header_size==
AnotherObject.header_size) ;
_result = _result && (AnObject.file_version==
AnotherObject.file_version) ;
_result = _result && (AnObject.pixmap_format==
AnotherObject.pixmap_format) ;
_result = _result && (AnObject.pixmap_depth==
AnotherObject.pixmap_depth) ;
_result = _result && (AnObject.pixmap_width==
AnotherObject.pixmap_width) ;
_result = _result && (AnObject.pixmap_height==
AnotherObject.pixmap_height) ;
_result = _result && (AnObject.xoffset==
AnotherObject.xoffset) ;
_result = _result && (AnObject.byte_order==
AnotherObject.byte_order) ;
_result = _result && (AnObject.bitmap_unit==
AnotherObject.bitmap_unit) ;
_result = _result && (AnObject.bitmap_bit_order==
AnotherObject.bitmap_bit_order) ;
_result = _result && (AnObject.bitmap_pad==
AnotherObject.bitmap_pad) ;
_result = _result && (AnObject.bits_per_pixel==
AnotherObject.bits_per_pixel) ;
_result = _result && (AnObject.bytes_per_line==
AnotherObject.bytes_per_line) ;
_result = _result && (AnObject.visual_class==
AnotherObject.visual_class) ;
_result = _result && (AnObject.red_mask==
AnotherObject.red_mask) ;
_result = _result && (AnObject.green_mask==
AnotherObject.green_mask) ;
_result = _result && (AnObject.blue_mask==
AnotherObject.blue_mask) ;
_result = _result && (AnObject.bits_per_rgb==
AnotherObject.bits_per_rgb) ;
_result = _result && (AnObject.colormap_entries==
AnotherObject.colormap_entries) ;
_result = _result && (AnObject.ncolors==
AnotherObject.ncolors) ;
_result = _result && (AnObject.window_width==
AnotherObject.window_width) ;
_result = _result && (AnObject.window_height==
AnotherObject.window_height) ;
_result = _result && (AnObject.window_x==
AnotherObject.window_x) ;
_result = _result && (AnObject.window_y==
AnotherObject.window_y) ;
_result = _result && (AnObject.window_bdrwidth==
AnotherObject.window_bdrwidth) ;
return _result;
}
//============================================================================
//==== ShallowDump : Writes a CString value.
//============================================================================
void ShallowDump (
const AlienImage_X11XWDFileHeader& AnObject,Standard_OStream& s) {
s << "AlienImage_X11XWDFileHeader" << "\n";
s << "\theader_size\t:" << AnObject.header_size << "\n" ;
s << "\tfile_version\t:" << AnObject.file_version << "\n" ;
s << "\tpixmap_format\t:" ; switch( AnObject.pixmap_format ) {
case XYBitmap :
s << "XYBitmap" ; break ;
case XYPixmap :
s << "XYPixmap" ; break ;
case ZPixmap :
s << "ZPixmap" ; break ;
default :
s << AnObject.pixmap_format ; break ;
} ; s << "\n" ;
s << "\tpixmap_depth\t:" << AnObject.pixmap_depth << "\n" ;
s << "\tpixmap_width\t:" << AnObject.pixmap_width << "\n" ;
s << "\tpixmap_height\t:" << AnObject.pixmap_height << "\n" ;
s << "\txoffset\t:" << AnObject.xoffset << "\n" ;
s << "\tbyte_order\t:" ;
if ( AnObject.byte_order == LSBFirst ) s << "LSBFirst" ;
else s << "MSBFirst" ;
s << "\n" ;
s << "\tbitmap_unit\t:" << AnObject.bitmap_unit << "\n" ;
s << "\tbitmap_bit_order\t:" ;
if ( AnObject.bitmap_bit_order == LSBFirst ) s << "LSBFirst" ;
else s << "MSBFirst" ;
s << "\n" ;
s << "\tbitmap_pad\t:" << AnObject.bitmap_pad << "\n" ;
s << "\tbits_per_pixel\t:" << AnObject.bits_per_pixel << "\n" ;
s << "\tbytes_per_line\t:" << AnObject.bytes_per_line << "\n" ;
s << "\tvisual_class\t:" ; switch( AnObject.visual_class ) {
case StaticGray : s << "StaticGray" ; break ;
case GrayScale : s << "GrayScale" ; break ;
case StaticColor : s << "StaticColor" ; break ;
case PseudoColor : s << "PseudoColor" ; break ;
case TrueColor : s << "TrueColor" ; break ;
case DirectColor : s << "DirectColor" ; break ;
default : s << AnObject.visual_class ; break ;
} ; s << "\n" ;
s << "\tred_mask\t:" << AnObject.red_mask << "\n" ;
s << "\tgreen_mask\t:" << AnObject.green_mask << "\n" ;
s << "\tblue_mask\t:" << AnObject.blue_mask << "\n" ;
s << "\tbits_per_rgb\t:" << AnObject.bits_per_rgb << "\n" ;
s << "\tcolormap_entries\t:" << AnObject.colormap_entries << "\n" ;
s << "\tncolors\t:" << AnObject.ncolors << "\n" ;
s << "\twindow_width\t:" << AnObject.window_width << "\n" ;
s << "\twindow_height\t:" << AnObject.window_height << "\n" ;
s << "\twindow_x\t:" << AnObject.window_x << "\n" ;
s << "\twindow_y\t:" << AnObject.window_y << "\n" ;
s << "\twindow_bdrwidth\t:" << AnObject.window_bdrwidth << "\n" << flush ;
}
ostream& operator << ( ostream& s, const AlienImage_X11XWDFileHeader& h )
{ ::ShallowDump( h, s ) ;
return( s ) ;
}

View File

@@ -1,49 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//============================================================================
//==== Titre: AlienImage_X11XWDFileHeader.hxx
//==== Role : The header file of primitve type "XWDFileHeader" from package //==== "X11"
//====
//==== Implementation: This is a primitive type implemented with typedef
//==== typedef XColor AlienImage_X11XWDFileHeader;
//============================================================================
#ifndef _AlienImage_X11XWDFileHeader_HeaderFile
#define _AlienImage_X11XWDFileHeader_HeaderFile
/*
* Data structure used by color operations from <X11/XWDFile.h>
*/
//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_X11XWDFileHeader);
//============================================================================
#include <Aspect_XWD.hxx>
typedef XWDFileHeader AlienImage_X11XWDFileHeader ;
ostream& operator << ( ostream& s, const AlienImage_X11XWDFileHeader& h );
Standard_Boolean operator==(const AlienImage_X11XWDFileHeader& AnObject,
const AlienImage_X11XWDFileHeader& AnotherObject);
void ShallowDump (const AlienImage_X11XWDFileHeader& AnObject,Standard_OStream& S) ;
#endif

View File

@@ -1,75 +0,0 @@
-- Created on: 1993-03-23
-- Created by: BBL
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class XAlienImage from AlienImage inherits AlienUserImage from AlienImage
---Purpose: Defines an X11 Alien image, i.e. an image file to be
-- used with X11 xwd utility.
uses
File from OSD,
AsciiString from TCollection,
ColorImage from Image,
PseudoColorImage from Image,
Image from Image,
X11XWDAlienData from AlienImage
is
Create returns mutable XAlienImage from AlienImage;
---Purpose: Constructs an empty X11 alien image.
Clear( me : in out mutable) ;
---Level: Public
---Purpose: Frees memory allocated by XAlienImage
---C++: alias ~
SetName( me : in out mutable;
aName : in AsciiString from TCollection) ;
---Purpose: Sets the Image name for the Name function.
Name( me : in immutable ) returns AsciiString from TCollection ;
---C++: return const &
---Purpose: Returns the Image name.
ToImage( me : in immutable )
returns mutable Image from Image ;
---Level: Public
---Purpose : Converts an XAlienImage object to a Image object.
FromImage( me : in out mutable ; anImage : in Image from Image ) ;
---Level: Public
---Purpose : Converts an Image object to a XAlienImage object.
Read ( me : in out mutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Reads the content of a XAlienImage object from a file .
-- Returns True if file is a XWD file .
Write( me : in immutable; afile : in out File from OSD )
returns Boolean from Standard ;
---Level: Public
---Purpose: Writes the content of a XAlienImage object to a file .
fields
myData : X11XWDAlienData from AlienImage;
end ;

View File

@@ -1,53 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <AlienImage_XAlienImage.ixx>
AlienImage_XAlienImage::AlienImage_XAlienImage()
{ // il faut faire un new si mydata est du type HANDLE
myData = new AlienImage_X11XWDAlienData() ;
}
void AlienImage_XAlienImage::SetName( const TCollection_AsciiString& aName)
{ myData->SetName( aName ) ; }
const TCollection_AsciiString& AlienImage_XAlienImage::Name() const
{ return( myData->Name() ) ; }
void AlienImage_XAlienImage::Clear()
{ myData->Clear() ; }
Standard_Boolean AlienImage_XAlienImage::Write( OSD_File& file ) const
{ return( myData->Write( file ) ) ; }
Standard_Boolean AlienImage_XAlienImage::Read( OSD_File& file )
{ return( myData->Read( file ) ) ; }
Handle_Image_Image AlienImage_XAlienImage::ToImage() const
{ return( myData->ToImage() ) ; }
void AlienImage_XAlienImage::FromImage( const Handle_Image_Image& anImage )
{ myData->FromImage( anImage ) ; }

View File

@@ -1,13 +0,0 @@
AlienImage_X11XColor.hxx
AlienImage_X11XColor.cxx
AlienImage_X11XWDFileHeader.hxx
AlienImage_X11XWDFileHeader.cxx
AlienImage_SGIRGBFileHeader.hxx
AlienImage_SGIRGBFileHeader.cxx
AlienImage_SUNRFFileHeader.hxx
AlienImage_SUNRFFileHeader.cxx
AlienImage_GIFLZWDict.hxx
AlienImage_GIFLZWDict.cxx
AlienImage_BMPHeader.hxx
AlienImage_BMPHeader.cxx

View File

@@ -478,11 +478,11 @@ Standard_Boolean Approx_SweepApproximation::D1(const Standard_Real Param,
myPoles->ChangeValue(ii).ChangeCoord()
-= Translation.XYZ();
// Homothety on all.
myDPoles->ChangeValue(ii) *= myWeigths->Value(ii);
const Standard_Real aWeight = myWeigths->Value(ii);
myDPoles->ChangeValue(ii) *= aWeight;
Vaux.SetXYZ( myPoles->Value(ii).Coord());
myDPoles->ChangeValue(ii) += myDWeigths->Value(ii)*Vaux;
myPoles->ChangeValue(ii).ChangeCoord()
*= myWeigths->Value(ii); // for the cash
myPoles->ChangeValue(ii).ChangeCoord() *= aWeight; // for the cash
}

View File

@@ -185,8 +185,11 @@ Standard_Boolean ApproxInt_ImpPrmSvSurfaces::Compute( Standard_Real& u1
}
static math_Vector BornInf(1,2),BornSup(1,2),F(1,1),X(1,2),Tolerance(1,2);
static math_Matrix D(1, 1, 1, 2);
Standard_Real aBornInf[2],aBornSup[2],aF[1],aX[2],aTolerance[2];
math_Vector BornInf(aBornInf,1,2),BornSup(aBornSup,1,2),F(aF,1,1),
X(aX,1,2),Tolerance(aTolerance,1,2);
Standard_Real aD[1][2];
math_Matrix D(aD,1, 1, 1, 2);
Standard_Real binfu,bsupu,binfv,bsupv;
binfu = ThePSurfaceTool::FirstUParameter(MyPSurf);

View File

@@ -105,7 +105,8 @@ Standard_Boolean ApproxInt_PrmPrmSvSurfaces::Compute( Standard_Real& u1
MyIsTangent = Standard_True;
static TColStd_Array1OfReal Param(1,4);
Standard_Real aParam[4];//stack vs heap allocation
TColStd_Array1OfReal Param (aParam[0],1,4);
Param(1) = u1; Param(2) = v1;
Param(3) = u2; Param(4) = v2;
math_FunctionSetRoot Rsnld(MyIntersectionOn2S.Function());

View File

@@ -856,7 +856,10 @@ is
-- are smaller than the printer's printing
-- area dimensions - use multiple printing
-- frames to cover the whole printing area
enumeration XAtom is
XA_DELETE_WINDOW
end XAtom;
---Purpose: Defines custom identifiers(atoms) for X window custom named properties
---------------------------------
-- Category: Instantiated classes
---------------------------------

View File

@@ -86,6 +86,7 @@ TCollection_AsciiString Aspect_DisplayConnection::GetDisplayName()
void Aspect_DisplayConnection::Init()
{
myDisplay = XOpenDisplay (myDisplayName.ToCString());
myAtoms.Bind (Aspect_XA_DELETE_WINDOW, XInternAtom(myDisplay, "WM_DELETE_WINDOW", False));
if (myDisplay == NULL)
{
@@ -95,4 +96,15 @@ void Aspect_DisplayConnection::Init()
Aspect_DisplayConnectionDefinitionError::Raise (aMessage.ToCString());
}
}
// =======================================================================
// function : GetAtom
// purpose :
// =======================================================================
Atom Aspect_DisplayConnection::GetAtom (const Aspect_XAtom theAtom) const
{
Atom anAtom = myAtoms.Find(theAtom);
return anAtom;
}
#endif

View File

@@ -20,8 +20,10 @@
#include <Standard_Transient.hxx>
#include <Aspect_DisplayConnection_Handle.hxx>
#include <Aspect_XAtom.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_DataMap.hxx>
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
#include <X11/Xlib.h>
@@ -53,6 +55,9 @@ public:
//! @return pointer to Display structure that serves as the connection to the X server.
Display* GetDisplay();
//! @return identifier(atom) for custom named property associated with windows that use current connection to X server.
Atom GetAtom (const Aspect_XAtom theAtom) const;
//! @return display name for this connection.
TCollection_AsciiString GetDisplayName();
@@ -64,6 +69,7 @@ private:
private:
Display* myDisplay;
NCollection_DataMap<Aspect_XAtom, Atom> myAtoms;
TCollection_AsciiString myDisplayName;
#endif

View File

@@ -333,7 +333,6 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
Standard_Integer aNb[6] = {aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
aVFs.Extent(), aEFs.Extent(), aFFs.Extent()};
//
Standard_Integer ind = 0;
for (Standard_Integer aTypeInt = 0; aTypeInt < 6; ++aTypeInt) {
for (Standard_Integer i = 0; i < aNb[aTypeInt]; ++i) {
BOPDS_Interf* aInt = (aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) :
@@ -348,6 +347,13 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
continue;
}
//
if (aTypeInt == 4) {
BOPDS_InterfEF& aEF=aEFs(i);
if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
continue;
}
}
//
const TopoDS_Shape& aS1 = theDS->Shape(nI1);
const TopoDS_Shape& aS2 = theDS->Shape(nI2);
//

View File

@@ -553,7 +553,11 @@ static
//
// 3. Find common parts
if (myOperation==BOPAlgo_COMMON) {
if (myDims[0]==myDims[1]) {
iX=(aNb[0]>aNb[1])? 1 : 0;
} else {
iX=(myDims[0]<myDims[1]) ? 0 : 1;
}
iY=(iX+1)%2;
}
else if (myOperation==BOPAlgo_CUT) {

View File

@@ -182,7 +182,7 @@ static
myShapesToAvoid.Clear();
//
iCnt=0;
while (1) {
for(;;) {
++iCnt;
bFound=Standard_False;
//

View File

@@ -166,7 +166,7 @@ static
myShapesToAvoid.Clear();
//
iCnt=0;
while (1) {
for(;;) {
++iCnt;
bFound=Standard_False;
//
@@ -178,9 +178,6 @@ static
if (!myShapesToAvoid.Contains(aF)) {
BOPTools::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
else {
int a=0;
}
}
aNbE=aMEF.Extent();
//

View File

@@ -92,14 +92,14 @@
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
const Handle(BOPDS_PaveBlock)& aPBR=aPB->RealPaveBlock();
const Handle(BOPDS_PaveBlock)& aPBR=myDS->RealPaveBlock(aPB);
//
nSpR=aPBR->Edge();
const TopoDS_Shape& aSpR=myDS->Shape(nSpR);
aLS.Append(aSpR);
myOrigins.Bind(aSpR, aE);
//
if (aPB->IsCommonBlockOnEdge()) {
if (myDS->IsCommonBlockOnEdge(aPB)) {
nSp=aPB->Edge();
const TopoDS_Shape& aSp=myDS->Shape(nSp);
myShapesSD.Bind(aSp, aSpR);

View File

@@ -570,7 +570,7 @@ void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
aMVAdd.Clear();
//
aMVP.Add(nV);
while(1) {
for(;;) {
aNbVP=aMVP.Extent();
for (j=1; j<=aNbVP; ++j) {
const TopoDS_Shape& nVP=aMVP(j);

View File

@@ -106,13 +106,13 @@ static
TopoDS_Face aFP;
BOPCol_ListIteratorOfListOfShape aItS, aItFP, aItEx;
//
BOPCol_ListOfShape aLIF(theAllocator);
BOPCol_MapOfShape aMFDone(100, theAllocator);
//BOPCol_ListOfShape aLIF(theAllocator);
//BOPCol_MapOfShape aMFDone(100, theAllocator);
//BOPCol_IndexedMapOfShape aMFIN(100, theAllocator);
//BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, theAllocator);
//BOPCol_IndexedMapOfShape aMS(100, theAllocator);
BOPCol_IndexedMapOfShape aMSolids(100, theAllocator);
BOPCol_IndexedMapOfShape aMFaces(100, theAllocator);
BOPCol_IndexedMapOfShape aMFIN(100, theAllocator);
BOPCol_IndexedMapOfShape aMS(100, theAllocator);
BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, theAllocator);
//
theDraftSolids.Clear();
//
@@ -153,12 +153,21 @@ static
aNbSolids=aMSolids.Extent();
//
for (i=1; i<=aNbSolids; ++i) {
const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aMSolids(i)));
Handle(NCollection_IncAllocator) aAllocator1;
aAllocator1=new NCollection_IncAllocator();
//
BOPCol_MapOfShape aMFDone(100, aAllocator1);
BOPCol_IndexedMapOfShape aMFIN(100, aAllocator1);
BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, aAllocator1);
BOPCol_ListOfShape aLIF(aAllocator1);
BOPCol_IndexedMapOfShape aMS(100, aAllocator1);
//
aMFDone.Clear();
aMFIN.Clear();
aMEF.Clear();
//
const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aMSolids(i)));
//
aBB.MakeSolid(aSolidSp);
//
// Draft solid and its pure internal faces => aSolidSp, aLIF
@@ -194,12 +203,12 @@ static
}
//
// 2 all faces that are not from aSolid [ aLFP1 ]
BOPCol_IndexedDataMapOfShapeListOfShape aMEFP(100, theAllocator);
BOPCol_ListOfShape aLFP1(theAllocator);
BOPCol_ListOfShape aLFP(theAllocator);
BOPCol_ListOfShape aLCBF(theAllocator);
BOPCol_ListOfShape aLFIN(theAllocator);
BOPCol_ListOfShape aLEx(theAllocator);
BOPCol_IndexedDataMapOfShapeListOfShape aMEFP(100, aAllocator1);
BOPCol_ListOfShape aLFP1(aAllocator1);
BOPCol_ListOfShape aLFP(aAllocator1);
BOPCol_ListOfShape aLCBF(aAllocator1);
BOPCol_ListOfShape aLFIN(aAllocator1);
BOPCol_ListOfShape aLEx(aAllocator1);
//
// for all non-solid faces build EF map [ aMEFP ]
for (j=1; j<=aNbFaces; ++j) {
@@ -278,7 +287,14 @@ static
// Connexity Block that spreads from aFP the Bound
// or till the end of the block itself
aLCBF.Clear();
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aMS, aLCBF, theAllocator);
{
Handle(NCollection_IncAllocator) aAllocator;
aAllocator=new NCollection_IncAllocator();
//
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aMS, aLCBF, aAllocator);
//
}
//
//
// fill states for the Connexity Block
aItS.Initialize(aLCBF);
@@ -316,7 +332,7 @@ static
if (aNbFIN || bHasImage) {
theDraftSolids.Bind(aSolid, aSolidSp);
}
}// for (; aItMS.More(); aItMS.Next()) {
}//for (i=1; i<=aNbSolids; ++i) {
}
//=======================================================================
//function : BuildDraftSolid

View File

@@ -29,7 +29,32 @@ is
returns CheckerSI from BOPAlgo;
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_CheckerSI();"
Perform(me:out)
is redefined;
Init (me:out)
is redefined protected;
SetLevelOfCheck(me:out;
theLevel: Integer from Standard);
---Purpose: Sets the level of checking shape on self-interference.
-- It defines which interferferences will be checked:
-- 0 - only V/V;
-- 1 - V/V and V/E;
-- 2 - V/V, V/E and E/E;
-- 3 - V/V, V/E, E/E and V/F;
-- 4 - V/V, V/E, E/E, V/F and E/F;
-- 5 - all interferences, default value.
PostTreat (me:out)
is protected;
---Purpose: Provides post-tratment actions
fields
myLevelOfCheck: Integer from Standard is protected;
end CheckerSI;

View File

@@ -23,15 +23,29 @@
#include <BOPDS_DS.hxx>
#include <BOPDS_IteratorSI.hxx>
#include <BOPDS_PIteratorSI.hxx>
#include <BOPInt_Context.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_MapOfPassKey.hxx>
#include <BOPDS_PassKey.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
#include <BOPDS_VectorOfPoint.hxx>
#include <BOPTools_AlgoTools.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
BOPAlgo_CheckerSI::BOPAlgo_CheckerSI()
:
BOPAlgo_PaveFiller()
BOPAlgo_PaveFiller(),
myLevelOfCheck(5)
{
}
//=======================================================================
@@ -42,6 +56,16 @@
{
}
//=======================================================================
//function : SetLevelOfCheck
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
{
if (theLevel >= 0 && theLevel <= 5) {
myLevelOfCheck = theLevel;
}
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
@@ -62,12 +86,139 @@
myDS->Init();
//
// 2.myIterator
myIterator=new BOPDS_IteratorSI(myAllocator);
myIterator->SetDS(myDS);
myIterator->Prepare();
BOPDS_PIteratorSI theIterSI=new BOPDS_IteratorSI(myAllocator);
theIterSI->SetDS(myDS);
theIterSI->Prepare();
theIterSI->UpdateByLevelOfCheck(myLevelOfCheck);
//
myIterator=theIterSI;
//
// 3 myContext
myContext=new BOPInt_Context;
//
myErrorStatus=0;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::Perform()
{
BOPAlgo_PaveFiller::Perform();
if (myErrorStatus) {
return;
}
//
PostTreat();
}
//=======================================================================
//function : PostTreat
//purpose :
//=======================================================================
void BOPAlgo_CheckerSI::PostTreat()
{
Standard_Integer i, aNb, n1, n2;
BOPDS_PassKey aPK;
//
BOPDS_MapOfPassKey& aMPK=*((BOPDS_MapOfPassKey*)&myDS->Interferences());
aMPK.Clear();
//
// 0
BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
aNb=aVVs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVV& aVV=aVVs(i);
aVV.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 1
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
aNb=aVEs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVE& aVE=aVEs(i);
aVE.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 2
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
aNb=aEEs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEE& aEE=aEEs(i);
aEE.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 3
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
aNb=aVFs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVF& aVF=aVFs(i);
aVF.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 4
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
aNb=aEFs.Extent();
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEF& aEF=aEFs(i);
if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
continue;
}
aEF.Indices(n1, n2);
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
//
// 5
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNb=aFFs.Extent();
for (i=0; i!=aNb; ++i) {
Standard_Boolean bTangentFaces, bFlag;
Standard_Integer aNbC, aNbP, j, iFound;
//
const BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(n1, n2);
//
bTangentFaces=aFF.TangentFaces();
aNbP=aFF.Points().Extent();
const BOPDS_VectorOfCurve& aVC=aFF.Curves();
aNbC=aVC.Extent();
if (!aNbP && !aNbC && !bTangentFaces) {
continue;
}
//
iFound=0;
if (bTangentFaces) {
const TopoDS_Face& aF1 = *((TopoDS_Face*)&myDS->Shape(n1));
const TopoDS_Face& aF2 = *((TopoDS_Face*)&myDS->Shape(n2));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aF1, aF2, myContext);
if (bFlag) {
++iFound;
}
}
else {
for (j=0; j!=aNbC; ++j) {
const BOPDS_Curve& aNC=aVC(j);
const BOPDS_ListOfPaveBlock& aLPBC=aNC.PaveBlocks();
if (aLPBC.Extent()) {
++iFound;
break;
}
}
}
//
if (!iFound) {
continue;
}
//
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
}

View File

@@ -80,6 +80,7 @@
}
//
if (myDS->HasInterfShapeSubShapes(nV, nE)) {
myDS->ChangePaveBlocks(nE);
continue;
}
//

View File

@@ -327,7 +327,7 @@
//=========================================
// post treatment
//=========================================
BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator);
BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator, myDS);
PerformVerticesEE(aMVCPB, aAllocator);
//-----------------------------------------------------scope t
aMPBLPB.Clear();
@@ -457,11 +457,11 @@
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
// 3
if (!aPB->IsCommonBlock()) {
if (!myDS->IsCommonBlock(aPB)) {
myDS->UpdatePaveBlock(aPB);
}
else {
const Handle(BOPDS_CommonBlock)& aCB=aPB->CommonBlock();
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
myDS->UpdateCommonBlock(aCB);
}
}//for (; aItMPBLI.More(); aItMPBLI.Next()) {
@@ -523,7 +523,7 @@
BOPCol_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
while(1) {
for(;;) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {

View File

@@ -75,6 +75,7 @@
}
//
if (myDS->HasInterfShapeSubShapes(nV, nF)) {
myDS->ChangeFaceInfo(nF);
continue;
}
//
@@ -102,6 +103,11 @@
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nVx, nF);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
//
if (aTolV < aTolF) {
aBB.UpdateVertex(aV, aTolF);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);

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