174 wxString filename = aFileName;
175 wxFileName tmpfilename;
177 if( aFileName.Upper().EndsWith( wxT(
"WRZ" ) ) )
179 wxFFileInputStream ifile( aFileName );
180 tmpfilename = wxFileName( aFileName );
182 tmpfilename.SetPath( wxStandardPaths::Get().GetTempDir() );
183 tmpfilename.SetExt( wxT(
"WRL" ) );
185 wxFileOffset size = ifile.GetLength();
187 if( size == wxInvalidOffset )
191 wxFFileOutputStream ofile( tmpfilename.GetFullPath() );
196 char *buffer =
new char[size];
198 ifile.Read( buffer, size);
199 std::string expanded;
203 expanded = gzip::decompress( buffer, size );
213 ofile.Write( expanded.data(), expanded.size() );
217 filename = tmpfilename.GetFullPath();
228 wxLogError( wxS(
" * " ) +
_(
"[INFO] load failed: input line too long\n" ) );
237 if( tmpfilename.IsOk() )
238 wxRemoveFile( tmpfilename.GetFullPath() );
242 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Processing VRML 1.0 file" ) );
246 if( !bp->
Read( proc ) )
261 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Processing VRML 2.0 file" ) );
268 if( !bp->
Read( proc ) )
283 if(
nullptr != modelFile )
287 #if ( defined( DEBUG_VRML1 ) && DEBUG_VRML1 > 3 ) \ 288 || ( defined( DEBUG_VRML2 ) && DEBUG_VRML2 > 3 ) 291 wxFileName fn( wxString::FromUTF8Unchecked( aFileName ) );
294 if( proc.GetVRMLType() ==
VRML_V1 )
295 output = wxT(
"_vrml1-" );
297 output = wxT(
"_vrml2-" );
299 output.append( fn.GetName() );
300 output.append( wxT(
".wrl") );
Represent the top node of a VRML1 model.
The base class of all Scene Graph nodes.
SGLIB_API bool WriteVRML(const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes)
Function WriteVRML writes out the given node and its subnodes to a VRML2 file.
void SetEnableInline(bool enable)
A LINE_READER that reads from an open file.
SGNODE * TranslateToSG(SGNODE *aParent, WRL1STATUS *sp) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
The top node of a VRML2 model.
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
Define the basic data set required to represent a 3D model.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...