File indexing completed on 2025-01-18 10:05:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef VrmlData_Scene_HeaderFile
0017 #define VrmlData_Scene_HeaderFile
0018
0019 #include <VrmlData_ListOfNode.hxx>
0020 #include <VrmlData_MapOfNode.hxx>
0021 #include <VrmlData_ErrorStatus.hxx>
0022 #include <VrmlData_WorldInfo.hxx>
0023 #include <TopoDS_Shape.hxx>
0024 #include <Standard_OStream.hxx>
0025 #include <Standard_IStream.hxx>
0026 #include <TCollection_ExtendedString.hxx>
0027 #include <NCollection_IncAllocator.hxx>
0028 #include <Standard_Mutex.hxx>
0029 #include <VrmlData_DataMapOfShapeAppearance.hxx>
0030
0031
0032 #ifdef Status
0033 #undef Status
0034 #endif
0035
0036 struct VrmlData_InBuffer;
0037
0038
0039
0040
0041
0042 class VrmlData_Scene
0043 {
0044 public:
0045
0046
0047
0048 typedef VrmlData_ListOfNode::Iterator Iterator;
0049
0050
0051
0052
0053
0054
0055 Standard_EXPORT VrmlData_Scene (const Handle(NCollection_IncAllocator)& = 0L);
0056
0057
0058
0059
0060
0061 inline VrmlData_ErrorStatus Status () const
0062 { return myStatus; }
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 Standard_EXPORT void SetVrmlDir (const TCollection_ExtendedString&);
0074
0075
0076
0077
0078
0079
0080 inline void SetLinearScale (const Standard_Real theScale)
0081 { myLinearScale = theScale; }
0082
0083
0084
0085
0086
0087 inline NCollection_List<TCollection_ExtendedString>::Iterator
0088 VrmlDirIterator () const
0089 { return NCollection_List<TCollection_ExtendedString>::Iterator(myVrmlDir); }
0090
0091
0092
0093
0094 inline Iterator GetIterator () const
0095 { return Iterator (myLstNodes); }
0096
0097
0098
0099
0100 inline VrmlData_MapOfNode::Iterator
0101 NamedNodesIterator() const
0102 { return myNamedNodes; }
0103
0104
0105
0106
0107 inline const Handle(NCollection_IncAllocator)&
0108 Allocator () const
0109 { return myAllocator; }
0110
0111
0112
0113
0114
0115
0116 Standard_EXPORT const Handle(VrmlData_Node)&
0117 AddNode (const Handle(VrmlData_Node)& theN,
0118 const Standard_Boolean isTopLevel
0119 = Standard_True);
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130 Standard_EXPORT Handle(VrmlData_Node)
0131 FindNode (const char * theName,
0132 const Handle(Standard_Type)&
0133 theType = 0L) const;
0134
0135
0136
0137
0138
0139
0140
0141
0142 Standard_EXPORT Handle(VrmlData_Node)
0143 FindNode(const char * theName,
0144 gp_Trsf& theLocation) const;
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156 friend Standard_EXPORT Standard_OStream&
0157 operator << (Standard_OStream& theOutput,
0158 const VrmlData_Scene& theScene);
0159
0160
0161
0162
0163
0164
0165 Standard_EXPORT VrmlData_Scene& operator<<(Standard_IStream& theInput);
0166
0167
0168
0169
0170 Standard_EXPORT operator TopoDS_Shape () const;
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 Standard_EXPORT TopoDS_Shape GetShape (VrmlData_DataMapOfShapeAppearance& M);
0185
0186
0187
0188
0189 Standard_EXPORT const Handle(VrmlData_WorldInfo)&
0190 WorldInfo() const;
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204 Standard_EXPORT static VrmlData_ErrorStatus
0205 ReadLine (VrmlData_InBuffer& theBuffer);
0206
0207
0208
0209
0210 Standard_EXPORT static VrmlData_ErrorStatus
0211 ReadWord (VrmlData_InBuffer& theBuffer,
0212 TCollection_AsciiString& theStr);
0213
0214
0215
0216
0217 Standard_EXPORT void Dump (Standard_OStream& theStream) const;
0218
0219
0220
0221
0222 Standard_EXPORT VrmlData_ErrorStatus
0223 ReadReal (VrmlData_InBuffer& theBuffer,
0224 Standard_Real& theResult,
0225 Standard_Boolean isApplyScale,
0226 Standard_Boolean isOnlyPositive)
0227 const;
0228
0229
0230
0231
0232 Standard_EXPORT VrmlData_ErrorStatus
0233 ReadXYZ (VrmlData_InBuffer& theBuffer,
0234 gp_XYZ& theXYZ,
0235 Standard_Boolean isApplyScale,
0236 Standard_Boolean isOnlyPositive)
0237 const;
0238
0239
0240
0241
0242 Standard_EXPORT VrmlData_ErrorStatus
0243 ReadXY (VrmlData_InBuffer& theBuffer,
0244 gp_XY& theXYZ,
0245 Standard_Boolean isApplyScale,
0246 Standard_Boolean isOnlyPositive)
0247 const;
0248
0249
0250
0251 Standard_EXPORT VrmlData_ErrorStatus
0252 ReadArrIndex(VrmlData_InBuffer& theBuffer,
0253 const Standard_Integer **& theArr,
0254 Standard_Size& theNBl)
0255 const;
0256
0257
0258
0259
0260 inline Standard_Integer GetLineError() const { return myLineError; }
0261
0262
0263
0264
0265
0266
0267 inline void SetIndent (const Standard_Integer nSpc)
0268 { myIndent = nSpc; }
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279 Standard_EXPORT VrmlData_ErrorStatus
0280 WriteXYZ (const gp_XYZ& theXYZ,
0281 const Standard_Boolean isScale,
0282 const char * thePostfix
0283 = 0L) const;
0284
0285
0286
0287 Standard_EXPORT VrmlData_ErrorStatus
0288 WriteArrIndex(const char * thePrefix,
0289 const Standard_Integer ** theArr,
0290 const Standard_Size theNbBl)
0291 const;
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310 Standard_EXPORT VrmlData_ErrorStatus
0311 WriteLine (const char * theLine0,
0312 const char * theLine1=0L,
0313 const Standard_Integer theIndent
0314 = 0) const;
0315
0316
0317
0318
0319 Standard_EXPORT VrmlData_ErrorStatus
0320 WriteNode (const char * thePrefix,
0321 const Handle(VrmlData_Node)&) const;
0322
0323
0324
0325
0326
0327 inline Standard_Boolean IsDummyWrite() const
0328 { return myOutput == 0L; }
0329
0330 private:
0331
0332 VrmlData_Scene (const VrmlData_Scene&);
0333 VrmlData_Scene& operator = (const VrmlData_Scene&);
0334
0335 protected:
0336
0337
0338
0339 Standard_EXPORT static VrmlData_ErrorStatus
0340 readLine (VrmlData_InBuffer& theBuffer);
0341
0342
0343
0344
0345 Standard_EXPORT static VrmlData_ErrorStatus
0346 readHeader (VrmlData_InBuffer& theBuffer);
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359 Standard_EXPORT VrmlData_ErrorStatus
0360 createNode (VrmlData_InBuffer& theBuffer,
0361 Handle(VrmlData_Node)& theNode,
0362 const Handle(Standard_Type)& Type);
0363
0364
0365
0366
0367 Standard_EXPORT static void createShape (TopoDS_Shape& outShape,
0368 const VrmlData_ListOfNode&,
0369 VrmlData_DataMapOfShapeAppearance*);
0370
0371
0372 private:
0373
0374 Standard_Real myLinearScale;
0375 VrmlData_ListOfNode myLstNodes;
0376 VrmlData_ListOfNode myAllNodes;
0377 VrmlData_ErrorStatus myStatus;
0378 Handle(NCollection_IncAllocator) myAllocator;
0379 Handle(VrmlData_WorldInfo) myWorldInfo;
0380 VrmlData_MapOfNode myNamedNodes;
0381
0382
0383 NCollection_List<TCollection_ExtendedString> myVrmlDir;
0384 Standard_Mutex myMutex;
0385 Standard_Integer myLineError;
0386
0387
0388 Standard_OStream * myOutput;
0389 Standard_Integer myIndent;
0390 Standard_Integer myCurrentIndent;
0391
0392
0393
0394
0395 VrmlData_MapOfNode myNamedNodesOut;
0396
0397
0398
0399
0400
0401
0402 NCollection_Map<Standard_Address> myUnnamedNodesOut;
0403 Standard_Integer myAutoNameCounter;
0404 friend class VrmlData_Group;
0405 friend class VrmlData_Node;
0406 };
0407
0408 #endif