1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/src/VrmlAPI/VrmlAPI_Writer.cdl
akz f5fa6b335c 0025279: OCCT fails to read VRML file created by OCCT
1) Version of VRML format is added to VrmlAPI_Writer::Write() and VrmlAPI::Write() to allow use the both versions of the VRML by one writer.
2) Unification of the command to write VRML of both versions. Now "writevrml" command can write VRLM files of v1.0 and v2.0, with wireframe/shaded/both representations. Parameter "Deflection" was removed (next commit will remove meshing, so parameter will be useless).
3) Meshing is removed from writers of both (v1.0 and v2.0) versions. Shaded representation is skipped in case when a mesh does not exist.
Wireframe representation checks the existence of a mesh before. If the mesh exists, a deflected edges are taken from the mesh, otherwise - are generated with the default deflection.
4) Drawing of redundant edges is removed in wireframe representation of VRML version 1.0 (a grid on non-plane surfaces does not match a real edges of TopoDS_Shape and does not match representation in version 2.0).

Test case for issue CR25279
2015-02-05 15:02:52 +03:00

125 lines
5.5 KiB
Plaintext

-- Created on: 2000-06-20
-- Created by: Sergey MOZOKHIN
-- Copyright (c) 2000-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Writer from VrmlAPI
---Purpose: Creates and writes VRML files from Open
-- CASCADE shapes. A VRML file can be written to
-- an existing VRML file or to a new one.
uses
Shape from TopoDS,
Drawer from VrmlConverter,
Projector from VrmlConverter,
Material from Vrml,
Length from Quantity,
HArray1OfColor from Quantity,
RepresentationOfShape from VrmlAPI
is
Create returns Writer from VrmlAPI;
---Purpose: Creates a writer object with default parameters.
ResetToDefaults(me : in out);
---Purpose: Resets all parameters (representation, deflection)
-- to their default values..
Drawer(me) returns Drawer from VrmlConverter;
---Purpose: Returns drawer object
SetDeflection(me : in out; aDef : Real from Standard);
---Purpose: Sets the deflection aDef of
-- the mesh algorithm which is used to compute the shaded
-- representation of the translated shape. The default
-- value is -1. When the deflection value is less than
-- 0, the deflection is calculated from the relative
-- size of the shaped.
SetRepresentation(me : in out; aRep : RepresentationOfShape from VrmlAPI);
---Purpose: Sets the representation of the
-- shape aRep which is written to the VRML file. The three options are :
-- - shaded
-- - wireframe
-- - both shaded and wireframe (default)
-- defined through the VrmlAPI_RepresentationOfShape enumeration.
SetTransparencyToMaterial(me : in out; aMaterial : in out Material from Vrml;
aTransparency : Real from Standard);
---Purpose: Set transparency to given material
SetShininessToMaterial(me : in out; aMaterial : in out Material from Vrml;
aShininess : Real from Standard);
SetAmbientColorToMaterial(me : in out ; aMaterial : in out Material from Vrml;
Color : HArray1OfColor from Quantity);
SetDiffuseColorToMaterial(me : in out ; aMaterial : in out Material from Vrml;
Color : HArray1OfColor from Quantity);
SetSpecularColorToMaterial(me : in out; aMaterial : in out Material from Vrml;
Color : HArray1OfColor from Quantity);
SetEmissiveColorToMaterial(me : in out ; aMaterial : in out Material from Vrml;
Color : HArray1OfColor from Quantity);
----------------- Returns fields of class --------------------------------------
GetRepresentation(me) returns RepresentationOfShape from VrmlAPI;
---Purpose: Returns the representation of the shape which is
-- written to the VRML file. Types of representation are set through the
-- VrmlAPI_RepresentationOfShape enumeration.
GetFrontMaterial(me) returns Material from Vrml;
GetPointsMaterial(me) returns Material from Vrml;
GetUisoMaterial(me) returns Material from Vrml;
GetVisoMaterial(me) returns Material from Vrml;
GetLineMaterial(me) returns Material from Vrml;
GetWireMaterial(me) returns Material from Vrml;
GetFreeBoundsMaterial(me) returns Material from Vrml;
GetUnfreeBoundsMaterial(me) returns Material from Vrml;
Write(me; aShape : Shape from TopoDS; aFile : CString from Standard; aVersion: Integer = 2);
---Purpose: Converts the shape aShape to
-- VRML format of the passed version and writes it to the file identified by aFile.
write_v1(me; aShape: Shape from TopoDS; aFileName: CString from Standard)
is protected;
---Purpose: Converts the shape aShape to VRML format of version 1.0 and writes it
-- to the file identified by aFileName using default parameters.
write_v2(me; aShape: Shape from TopoDS; aFileName: CString from Standard)
is protected;
---Purpose: Converts the shape aShape to VRML format of version 2.0 and writes it
-- to the file identified by aFileName using default parameters.
fields
myRepresentation : RepresentationOfShape from VrmlAPI;
myDrawer : Drawer from VrmlConverter;
myDeflection : Real from Standard;
myPerespectiveCamera : Projector from VrmlConverter;
myOrthographicCamera : Projector from VrmlConverter;
myTransparency : Real;
myShininess : Real;
myFrontMaterial : Material from Vrml;
myPointsMaterial : Material from Vrml;
myUisoMaterial : Material from Vrml;
myVisoMaterial : Material from Vrml;
myLineMaterial : Material from Vrml;
myWireMaterial : Material from Vrml;
myFreeBoundsMaterial : Material from Vrml;
myUnfreeBoundsMaterial : Material from Vrml;
--Projection Vector
DX : Length from Quantity;
DY : Length from Quantity;
DZ : Length from Quantity;
--High Point Direction
XUp : Length from Quantity;
YUp : Length from Quantity;
ZUp : Length from Quantity;
--Focus
Focus : Length from Quantity;
end Writer;