| 1 | -- File: VrmlAPI_Writer.cdl |
| 2 | -- Created: Tue Jun 20 18:00:44 2000 |
| 3 | -- Author: Sergey MOZOKHIN |
| 4 | -- <smh@russox.nnov.matra-dtv.fr> |
| 5 | ---Copyright: Matra Datavision 2000 |
| 6 | |
| 7 | |
| 8 | class Writer from VrmlAPI |
| 9 | |
| 10 | ---Purpose: Creates and writes VRML files from Open |
| 11 | -- CASCADE shapes. A VRML file can be written to |
| 12 | -- an existing VRML file or to a new one. |
| 13 | |
| 14 | uses |
| 15 | Shape from TopoDS, |
| 16 | Drawer from VrmlConverter, |
| 17 | Projector from VrmlConverter, |
| 18 | Material from Vrml, |
| 19 | Length from Quantity, |
| 20 | HArray1OfColor from Quantity, |
| 21 | RepresentationOfShape from VrmlAPI |
| 22 | is |
| 23 | Create returns Writer from VrmlAPI; |
| 24 | ---Purpose: Creates a writer object with default parameters. |
| 25 | ResetToDefaults(me : in out); |
| 26 | ---Purpose: Resets all parameters (representation, deflection) |
| 27 | -- to their default values.. |
| 28 | |
| 29 | Drawer(me) returns Drawer from VrmlConverter; |
| 30 | ---Purpose: Returns drawer object |
| 31 | |
| 32 | SetDeflection(me : in out; aDef : Real from Standard); |
| 33 | ---Purpose: Sets the deflection aDef of |
| 34 | -- the mesh algorithm which is used to compute the shaded |
| 35 | -- representation of the translated shape. The default |
| 36 | -- value is -1. When the deflection value is less than |
| 37 | -- 0, the deflection is calculated from the relative |
| 38 | -- size of the shaped. |
| 39 | |
| 40 | SetRepresentation(me : in out; aRep : RepresentationOfShape from VrmlAPI); |
| 41 | ---Purpose: Sets the representation of the |
| 42 | -- shape aRep which is written to the VRML file. The three options are : |
| 43 | -- - shaded |
| 44 | -- - wireframe |
| 45 | -- - both shaded and wireframe (default) |
| 46 | -- defined through the VrmlAPI_RepresentationOfShape enumeration. |
| 47 | |
| 48 | SetTransparencyToMaterial(me : in out; aMaterial : in out Material from Vrml; |
| 49 | aTransparency : Real from Standard); |
| 50 | ---Purpose: Set transparency to given material |
| 51 | |
| 52 | SetShininessToMaterial(me : in out; aMaterial : in out Material from Vrml; |
| 53 | aShininess : Real from Standard); |
| 54 | SetAmbientColorToMaterial(me : in out ; aMaterial : in out Material from Vrml; |
| 55 | Color : HArray1OfColor from Quantity); |
| 56 | SetDiffuseColorToMaterial(me : in out ; aMaterial : in out Material from Vrml; |
| 57 | Color : HArray1OfColor from Quantity); |
| 58 | SetSpecularColorToMaterial(me : in out; aMaterial : in out Material from Vrml; |
| 59 | Color : HArray1OfColor from Quantity); |
| 60 | SetEmissiveColorToMaterial(me : in out ; aMaterial : in out Material from Vrml; |
| 61 | Color : HArray1OfColor from Quantity); |
| 62 | ----------------- Returns fields of class -------------------------------------- |
| 63 | GetRepresentation(me) returns RepresentationOfShape from VrmlAPI; |
| 64 | ---Purpose: Returns the representation of the shape which is |
| 65 | -- written to the VRML file. Types of representation are set through the |
| 66 | -- VrmlAPI_RepresentationOfShape enumeration. |
| 67 | GetFrontMaterial(me) returns Material from Vrml; |
| 68 | GetPointsMaterial(me) returns Material from Vrml; |
| 69 | GetUisoMaterial(me) returns Material from Vrml; |
| 70 | GetVisoMaterial(me) returns Material from Vrml; |
| 71 | GetLineMaterial(me) returns Material from Vrml; |
| 72 | GetWireMaterial(me) returns Material from Vrml; |
| 73 | GetFreeBoundsMaterial(me) returns Material from Vrml; |
| 74 | GetUnfreeBoundsMaterial(me) returns Material from Vrml; |
| 75 | |
| 76 | Write(me; aShape : Shape from TopoDS; aFile : CString from Standard); |
| 77 | ---Purpose: Converts the shape aShape to |
| 78 | -- VRML format and writes it to the file identified by aFile. |
| 79 | |
| 80 | fields |
| 81 | myRepresentation : RepresentationOfShape from VrmlAPI; |
| 82 | myDrawer : Drawer from VrmlConverter; |
| 83 | myDeflection : Real from Standard; |
| 84 | myPerespectiveCamera : Projector from VrmlConverter; |
| 85 | myOrthographicCamera : Projector from VrmlConverter; |
| 86 | myTransparency : Real; |
| 87 | myShininess : Real; |
| 88 | myFrontMaterial : Material from Vrml; |
| 89 | myPointsMaterial : Material from Vrml; |
| 90 | myUisoMaterial : Material from Vrml; |
| 91 | myVisoMaterial : Material from Vrml; |
| 92 | myLineMaterial : Material from Vrml; |
| 93 | myWireMaterial : Material from Vrml; |
| 94 | myFreeBoundsMaterial : Material from Vrml; |
| 95 | myUnfreeBoundsMaterial : Material from Vrml; |
| 96 | --Projection Vector |
| 97 | DX : Length from Quantity; |
| 98 | DY : Length from Quantity; |
| 99 | DZ : Length from Quantity; |
| 100 | --High Point Direction |
| 101 | XUp : Length from Quantity; |
| 102 | YUp : Length from Quantity; |
| 103 | ZUp : Length from Quantity; |
| 104 | --Focus |
| 105 | Focus : Length from Quantity; |
| 106 | end Writer; |