More NULL expunging.
This commit is contained in:
parent
6001ac0704
commit
4c457b5ed3
|
@ -154,10 +154,10 @@ private:
|
||||||
if( nextZ )
|
if( nextZ )
|
||||||
nextZ->prevZ = prevZ;
|
nextZ->prevZ = prevZ;
|
||||||
|
|
||||||
next = NULL;
|
next = nullptr;
|
||||||
prev = NULL;
|
prev = nullptr;
|
||||||
nextZ = NULL;
|
nextZ = nullptr;
|
||||||
prevZ = NULL;
|
prevZ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateOrder()
|
void updateOrder()
|
||||||
|
|
|
@ -139,7 +139,7 @@ public:
|
||||||
virtual SHAPE* Clone() const
|
virtual SHAPE* Clone() const
|
||||||
{
|
{
|
||||||
assert( false );
|
assert( false );
|
||||||
return NULL;
|
return nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 CERN
|
* Copyright (C) 2013 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -275,7 +276,7 @@ public:
|
||||||
|
|
||||||
const query_iterator qend()
|
const query_iterator qend()
|
||||||
{
|
{
|
||||||
return query_iterator( m_shapes.end(), m_shapes.end(), NULL, 0, false );
|
return query_iterator( m_shapes.end(), m_shapes.end(), nullptr, 0, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator begin()
|
iterator begin()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 CERN
|
* Copyright (C) 2013 CERN
|
||||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
#include <geometry/shape.h>
|
#include <geometry/shape.h>
|
||||||
#include <geometry/shape_file_io.h>
|
#include <geometry/shape_file_io.h>
|
||||||
|
|
||||||
|
|
||||||
SHAPE_FILE_IO::SHAPE_FILE_IO()
|
SHAPE_FILE_IO::SHAPE_FILE_IO()
|
||||||
{
|
{
|
||||||
m_groupActive = false;
|
m_groupActive = false;
|
||||||
|
@ -37,6 +38,7 @@ SHAPE_FILE_IO::SHAPE_FILE_IO()
|
||||||
m_file = stdout;
|
m_file = stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SHAPE_FILE_IO::SHAPE_FILE_IO( const std::string& aFilename, SHAPE_FILE_IO::IO_MODE aMode )
|
SHAPE_FILE_IO::SHAPE_FILE_IO( const std::string& aFilename, SHAPE_FILE_IO::IO_MODE aMode )
|
||||||
{
|
{
|
||||||
m_groupActive = false;
|
m_groupActive = false;
|
||||||
|
@ -54,7 +56,7 @@ SHAPE_FILE_IO::SHAPE_FILE_IO( const std::string& aFilename, SHAPE_FILE_IO::IO_MO
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_file = NULL;
|
m_file = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mode = aMode;
|
m_mode = aMode;
|
||||||
|
@ -84,7 +86,7 @@ SHAPE* SHAPE_FILE_IO::Read()
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (fscanf(m_file, "%s", tmp) != 1)
|
if (fscanf(m_file, "%s", tmp) != 1)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( !strcmp( tmp, "shape" )
|
if( !strcmp( tmp, "shape" )
|
||||||
break;
|
break;
|
||||||
|
@ -92,7 +94,7 @@ SHAPE* SHAPE_FILE_IO::Read()
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
SHAPE *rv = NULL;
|
SHAPE *rv = nullptr;
|
||||||
|
|
||||||
fscanf(m_file,"%d %s", &type, tmp);
|
fscanf(m_file,"%d %s", &type, tmp);
|
||||||
|
|
||||||
|
@ -104,14 +106,14 @@ SHAPE* SHAPE_FILE_IO::Read()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!rv)
|
if(!rv)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
rv.Parse ( )
|
rv.Parse ( )
|
||||||
|
|
||||||
fprintf(m_file,"shape %d %s %s\n", aShape->Type(), aName.c_str(), sh.c_str() );
|
fprintf(m_file,"shape %d %s %s\n", aShape->Type(), aName.c_str(), sh.c_str() );
|
||||||
*/
|
*/
|
||||||
assert( false );
|
assert( false );
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ SHAPE* SHAPE_POLY_SET::Clone() const
|
||||||
|
|
||||||
|
|
||||||
bool SHAPE_POLY_SET::GetRelativeIndices( int aGlobalIdx,
|
bool SHAPE_POLY_SET::GetRelativeIndices( int aGlobalIdx,
|
||||||
SHAPE_POLY_SET::VERTEX_INDEX* aRelativeIndices ) const
|
SHAPE_POLY_SET::VERTEX_INDEX* aRelativeIndices ) const
|
||||||
{
|
{
|
||||||
int polygonIdx = 0;
|
int polygonIdx = 0;
|
||||||
unsigned int contourIdx = 0;
|
unsigned int contourIdx = 0;
|
||||||
|
@ -652,7 +652,8 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET
|
||||||
CLIPPER_Z_VALUE zval = newIntersectPoints.at( pt );
|
CLIPPER_Z_VALUE zval = newIntersectPoints.at( pt );
|
||||||
|
|
||||||
// Fixup arc end points to match the new intersection points found in clipper
|
// Fixup arc end points to match the new intersection points found in clipper
|
||||||
//@todo consider editing the intersection point to be the "true" arc intersection
|
// @todo consider editing the intersection point to be the "true" arc
|
||||||
|
// intersection.
|
||||||
if( poly[i].IsSharedPt( j ) )
|
if( poly[i].IsSharedPt( j ) )
|
||||||
{
|
{
|
||||||
poly[i].amendArcEnd( shape.first, pt );
|
poly[i].amendArcEnd( shape.first, pt );
|
||||||
|
@ -845,7 +846,7 @@ struct FractureEdge
|
||||||
{
|
{
|
||||||
FractureEdge( int y = 0 ) :
|
FractureEdge( int y = 0 ) :
|
||||||
m_connected( false ),
|
m_connected( false ),
|
||||||
m_next( NULL )
|
m_next( nullptr )
|
||||||
{
|
{
|
||||||
m_p1.x = m_p2.y = y;
|
m_p1.x = m_p2.y = y;
|
||||||
}
|
}
|
||||||
|
@ -854,7 +855,7 @@ struct FractureEdge
|
||||||
m_connected( connected ),
|
m_connected( connected ),
|
||||||
m_p1( p1 ),
|
m_p1( p1 ),
|
||||||
m_p2( p2 ),
|
m_p2( p2 ),
|
||||||
m_next( NULL )
|
m_next( nullptr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,7 +881,7 @@ static int processEdge( FractureEdgeSet& edges, FractureEdge* edge )
|
||||||
int min_dist = std::numeric_limits<int>::max();
|
int min_dist = std::numeric_limits<int>::max();
|
||||||
int x_nearest = 0;
|
int x_nearest = 0;
|
||||||
|
|
||||||
FractureEdge* e_nearest = NULL;
|
FractureEdge* e_nearest = nullptr;
|
||||||
|
|
||||||
for( FractureEdge* e : edges )
|
for( FractureEdge* e : edges )
|
||||||
{
|
{
|
||||||
|
@ -951,7 +952,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
||||||
{
|
{
|
||||||
FractureEdgeSet edges;
|
FractureEdgeSet edges;
|
||||||
FractureEdgeSet border_edges;
|
FractureEdgeSet border_edges;
|
||||||
FractureEdge* root = NULL;
|
FractureEdge* root = nullptr;
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
@ -965,7 +966,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
||||||
const std::vector<VECTOR2I>& points = path.CPoints();
|
const std::vector<VECTOR2I>& points = path.CPoints();
|
||||||
int pointCount = points.size();
|
int pointCount = points.size();
|
||||||
|
|
||||||
FractureEdge* prev = NULL, * first_edge = NULL;
|
FractureEdge* prev = nullptr, * first_edge = nullptr;
|
||||||
|
|
||||||
int x_min = std::numeric_limits<int>::max();
|
int x_min = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
|
@ -980,7 +981,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
||||||
// Do not use path.CPoint() here; open-coding it using the local variables "points"
|
// Do not use path.CPoint() here; open-coding it using the local variables "points"
|
||||||
// and "pointCount" gives a non-trivial performance boost to zone fill times.
|
// and "pointCount" gives a non-trivial performance boost to zone fill times.
|
||||||
FractureEdge* fe = new FractureEdge( first, points[ i ],
|
FractureEdge* fe = new FractureEdge( first, points[ i ],
|
||||||
points[ i+1 == pointCount ? 0 : i+1 ] );
|
points[ i+1 == pointCount ? 0 : i+1 ] );
|
||||||
|
|
||||||
if( !root )
|
if( !root )
|
||||||
root = fe;
|
root = fe;
|
||||||
|
@ -1015,7 +1016,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
||||||
{
|
{
|
||||||
int x_min = std::numeric_limits<int>::max();
|
int x_min = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
FractureEdge* smallestX = NULL;
|
FractureEdge* smallestX = nullptr;
|
||||||
|
|
||||||
// find the left-most hole edge and merge with the outline
|
// find the left-most hole edge and merge with the outline
|
||||||
for( FractureEdge* border_edge : border_edges )
|
for( FractureEdge* border_edge : border_edges )
|
||||||
|
@ -1274,7 +1275,7 @@ int SHAPE_POLY_SET::NormalizeAreaOutlines()
|
||||||
|
|
||||||
Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
Simplify( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||||
|
|
||||||
// If any hole, substract it to main outline
|
// If any hole, subtract it to main outline
|
||||||
if( holesBuffer.OutlineCount() )
|
if( holesBuffer.OutlineCount() )
|
||||||
{
|
{
|
||||||
holesBuffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
holesBuffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
@ -2022,7 +2023,8 @@ SHAPE_POLY_SET SHAPE_POLY_SET::Fillet( int aRadius, int aErrorMax )
|
||||||
|
|
||||||
|
|
||||||
SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::chamferFilletPolygon( CORNER_MODE aMode,
|
SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::chamferFilletPolygon( CORNER_MODE aMode,
|
||||||
unsigned int aDistance, int aIndex, int aErrorMax )
|
unsigned int aDistance,
|
||||||
|
int aIndex, int aErrorMax )
|
||||||
{
|
{
|
||||||
// Null segments create serious issues in calculations. Remove them:
|
// Null segments create serious issues in calculations. Remove them:
|
||||||
RemoveNullSegments();
|
RemoveNullSegments();
|
||||||
|
@ -2204,6 +2206,7 @@ SHAPE_POLY_SET &SHAPE_POLY_SET::operator=( const SHAPE_POLY_SET& aOther )
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MD5_HASH SHAPE_POLY_SET::GetHash() const
|
MD5_HASH SHAPE_POLY_SET::GetHash() const
|
||||||
{
|
{
|
||||||
if( !m_hash.IsValid() )
|
if( !m_hash.IsValid() )
|
||||||
|
@ -2323,7 +2326,7 @@ void SHAPE_POLY_SET::CacheTriangulation( bool aPartition )
|
||||||
|
|
||||||
if( aPartition )
|
if( aPartition )
|
||||||
{
|
{
|
||||||
// This partitions into regularly-sized grids (1cm in pcbnew)
|
// This partitions into regularly-sized grids (1cm in Pcbnew)
|
||||||
SHAPE_POLY_SET flattened( *this );
|
SHAPE_POLY_SET flattened( *this );
|
||||||
flattened.ClearArcs();
|
flattened.ClearArcs();
|
||||||
partitionPolyIntoRegularCellGrid( flattened, 1e7, tmpSet );
|
partitionPolyIntoRegularCellGrid( flattened, 1e7, tmpSet );
|
||||||
|
@ -2344,7 +2347,7 @@ void SHAPE_POLY_SET::CacheTriangulation( bool aPartition )
|
||||||
m_triangulatedPolys.push_back( std::make_unique<TRIANGULATED_POLYGON>() );
|
m_triangulatedPolys.push_back( std::make_unique<TRIANGULATED_POLYGON>() );
|
||||||
PolygonTriangulation tess( *m_triangulatedPolys.back() );
|
PolygonTriangulation tess( *m_triangulatedPolys.back() );
|
||||||
|
|
||||||
// If the tesselation fails, we re-fracture the polygon, which will
|
// If the tessellation fails, we re-fracture the polygon, which will
|
||||||
// first simplify the system before fracturing and removing the holes
|
// first simplify the system before fracturing and removing the holes
|
||||||
// This may result in multiple, disjoint polygons.
|
// This may result in multiple, disjoint polygons.
|
||||||
if( !tess.TesselatePolygon( tmpSet.Polygon( 0 ).front() ) )
|
if( !tess.TesselatePolygon( tmpSet.Polygon( 0 ).front() ) )
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Mark Roszko <mark.roszko@gmail.com>
|
* Copyright (C) 2020 Mark Roszko <mark.roszko@gmail.com>
|
||||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -41,7 +41,7 @@ bool KIPLATFORM::APP::Init()
|
||||||
{
|
{
|
||||||
#if !defined( KICAD_SHOW_GTK_MESSAGES )
|
#if !defined( KICAD_SHOW_GTK_MESSAGES )
|
||||||
// Attach a logger that will consume the annoying GTK error messages
|
// Attach a logger that will consume the annoying GTK error messages
|
||||||
g_log_set_writer_func( nullLogWriter, NULL, NULL );
|
g_log_set_writer_func( nullLogWriter, nullptr, nullptr );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Ian McInerney <Ian.S.McInerney at ieee.org>
|
* Copyright (C) 2020 Ian McInerney <Ian.S.McInerney at ieee.org>
|
||||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -90,7 +90,8 @@ bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
|
||||||
|
|
||||||
void KIPLATFORM::UI::EllipsizeChoiceBox( wxChoice* aChoice )
|
void KIPLATFORM::UI::EllipsizeChoiceBox( wxChoice* aChoice )
|
||||||
{
|
{
|
||||||
// This function is based on the code inside the function post_process_ui in gtkfilechooserwidget.c
|
// This function is based on the code inside the function post_process_ui in
|
||||||
|
// gtkfilechooserwidget.c
|
||||||
GList* cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( aChoice->m_widget ) );
|
GList* cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( aChoice->m_widget ) );
|
||||||
|
|
||||||
if( !cells )
|
if( !cells )
|
||||||
|
@ -101,7 +102,7 @@ void KIPLATFORM::UI::EllipsizeChoiceBox( wxChoice* aChoice )
|
||||||
if( !cell )
|
if( !cell )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_object_set( G_OBJECT( cell ), "ellipsize", PANGO_ELLIPSIZE_END, NULL );
|
g_object_set( G_OBJECT( cell ), "ellipsize", PANGO_ELLIPSIZE_END, nullptr );
|
||||||
|
|
||||||
// Only the list of cells must be freed, the renderer isn't ours to free
|
// Only the list of cells must be freed, the renderer isn't ours to free
|
||||||
g_list_free( cells );
|
g_list_free( cells );
|
||||||
|
@ -114,7 +115,7 @@ double KIPLATFORM::UI::GetSystemScaleFactor( const wxWindow* aWindow )
|
||||||
|
|
||||||
GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
|
GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
|
||||||
|
|
||||||
if( widget && gtk_check_version( 3, 10, 0 ) == NULL )
|
if( widget && gtk_check_version( 3, 10, 0 ) == nullptr )
|
||||||
val = gtk_widget_get_scale_factor( widget );
|
val = gtk_widget_get_scale_factor( widget );
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Ian McInerney <Ian.S.McInerney at ieee.org>
|
* Copyright (C) 2020 Ian McInerney <Ian.S.McInerney at ieee.org>
|
||||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by the
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -44,10 +44,10 @@ bool KIPLATFORM::ENV::MoveToTrash( const wxString& aPath, wxString& aError )
|
||||||
SHFILEOPSTRUCT fileOp;
|
SHFILEOPSTRUCT fileOp;
|
||||||
::ZeroMemory( &fileOp, sizeof( fileOp ) );
|
::ZeroMemory( &fileOp, sizeof( fileOp ) );
|
||||||
|
|
||||||
fileOp.hwnd = NULL; // Set to null since there is no progress dialog
|
fileOp.hwnd = nullptr; // Set to null since there is no progress dialog
|
||||||
fileOp.wFunc = FO_DELETE;
|
fileOp.wFunc = FO_DELETE;
|
||||||
fileOp.pFrom = temp.c_str();
|
fileOp.pFrom = temp.c_str();
|
||||||
fileOp.pTo = NULL; // Set to to NULL since we aren't moving the file
|
fileOp.pTo = nullptr; // Set to to NULL since we aren't moving the file
|
||||||
fileOp.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_NOCONFIRMATION | FOF_SILENT;
|
fileOp.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_NOCONFIRMATION | FOF_SILENT;
|
||||||
|
|
||||||
int eVal = SHFileOperation( &fileOp );
|
int eVal = SHFileOperation( &fileOp );
|
||||||
|
@ -70,7 +70,7 @@ bool KIPLATFORM::ENV::IsNetworkPath( const wxString& aPath )
|
||||||
|
|
||||||
wxString KIPLATFORM::ENV::GetDocumentsPath()
|
wxString KIPLATFORM::ENV::GetDocumentsPath()
|
||||||
{
|
{
|
||||||
// If called by a python script in stand-alone (outside kicad), wxStandardPaths::Get()
|
// If called by a python script in stand-alone (outside KiCad), wxStandardPaths::Get()
|
||||||
// complains about not existing app. so use a dummy app
|
// complains about not existing app. so use a dummy app
|
||||||
if( wxTheApp == nullptr )
|
if( wxTheApp == nullptr )
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ wxString KIPLATFORM::ENV::GetDocumentsPath()
|
||||||
|
|
||||||
wxString KIPLATFORM::ENV::GetUserConfigPath()
|
wxString KIPLATFORM::ENV::GetUserConfigPath()
|
||||||
{
|
{
|
||||||
// If called by a python script in stand-alone (outside kicad), wxStandardPaths::Get()
|
// If called by a python script in stand-alone (outside KiCad), wxStandardPaths::Get()
|
||||||
// complains about not existing app. so use a dummy app
|
// complains about not existing app. so use a dummy app
|
||||||
if( wxTheApp == nullptr )
|
if( wxTheApp == nullptr )
|
||||||
{
|
{
|
||||||
|
@ -100,9 +100,9 @@ wxString KIPLATFORM::ENV::GetUserCachePath()
|
||||||
{
|
{
|
||||||
// Unfortunately AppData/Local is the closest analog to "Cache" directories of other platforms
|
// Unfortunately AppData/Local is the closest analog to "Cache" directories of other platforms
|
||||||
|
|
||||||
// Make sure we dont include the "appinfo" (appended app name)
|
// Make sure we don't include the "appinfo" (appended app name)
|
||||||
|
|
||||||
// If called by a python script in stand-alone (outside kicad), wxStandardPaths::Get()
|
// If called by a python script in stand-alone (outside KiCad), wxStandardPaths::Get()
|
||||||
// complains about not existing app. so use a dummy app
|
// complains about not existing app. so use a dummy app
|
||||||
if( wxTheApp == nullptr )
|
if( wxTheApp == nullptr )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 Mark Roszko <mark.roszko@gmail.com>
|
* Copyright (C) 2016 Mark Roszko <mark.roszko@gmail.com>
|
||||||
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -118,7 +118,7 @@ namespace SEXPR
|
||||||
}
|
}
|
||||||
else if( *it == ')' )
|
else if( *it == ')' )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( *it == '"' )
|
else if( *it == '"' )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 CERN
|
* Copyright (C) 2013 CERN
|
||||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
PLEDITOR_PRINTOUT( PL_EDITOR_FRAME* aParent, const wxString& aTitle ) :
|
PLEDITOR_PRINTOUT( PL_EDITOR_FRAME* aParent, const wxString& aTitle ) :
|
||||||
wxPrintout( aTitle )
|
wxPrintout( aTitle )
|
||||||
{
|
{
|
||||||
wxASSERT( aParent != NULL );
|
wxASSERT( aParent != nullptr );
|
||||||
m_parent = aParent;
|
m_parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +93,10 @@ public:
|
||||||
if( show )
|
if( show )
|
||||||
{
|
{
|
||||||
bool centre = false;
|
bool centre = false;
|
||||||
|
|
||||||
if( s_size.x == 0 || s_size.y == 0 )
|
if( s_size.x == 0 || s_size.y == 0 )
|
||||||
{
|
{
|
||||||
s_size = (m_parent->GetSize() * 3) / 4;
|
s_size = ( m_parent->GetSize() * 3 ) / 4;
|
||||||
s_pos = wxDefaultPosition;
|
s_pos = wxDefaultPosition;
|
||||||
centre = true;
|
centre = true;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +116,7 @@ public:
|
||||||
|
|
||||||
ret = wxPreviewFrame::Show( show );
|
ret = wxPreviewFrame::Show( show );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,9 +156,7 @@ void PLEDITOR_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
|
||||||
*maxPage = *selPageTo = 2;
|
*maxPage = *selPageTo = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the real print function: print the active screen
|
|
||||||
*/
|
|
||||||
void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
|
void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
|
||||||
{
|
{
|
||||||
wxPoint tmp_startvisu;
|
wxPoint tmp_startvisu;
|
||||||
|
|
|
@ -38,25 +38,39 @@
|
||||||
PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
|
PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
|
||||||
PANEL_PROPERTIES_BASE( aParent ),
|
PANEL_PROPERTIES_BASE( aParent ),
|
||||||
m_scintillaTricks( nullptr ),
|
m_scintillaTricks( nullptr ),
|
||||||
m_textCtrlTextSizeXBinder( aParent, m_staticTextTsizeX, m_textCtrlTextSizeX, m_TextTextSizeXUnits ),
|
m_textCtrlTextSizeXBinder( aParent, m_staticTextTsizeX, m_textCtrlTextSizeX,
|
||||||
m_textCtrlTextSizeYBinder( aParent, m_staticTextTsizeY, m_textCtrlTextSizeY, m_TextTextSizeYUnits ),
|
m_TextTextSizeXUnits ),
|
||||||
m_textCtrlConstraintXBinder( aParent, m_staticTextConstraintX, m_textCtrlConstraintX, m_TextConstraintXUnits ),
|
m_textCtrlTextSizeYBinder( aParent, m_staticTextTsizeY, m_textCtrlTextSizeY,
|
||||||
m_textCtrlConstraintYBinder( aParent, m_staticTextConstraintY, m_textCtrlConstraintY, m_TextConstraintYUnits ),
|
m_TextTextSizeYUnits ),
|
||||||
|
m_textCtrlConstraintXBinder( aParent, m_staticTextConstraintX, m_textCtrlConstraintX,
|
||||||
|
m_TextConstraintXUnits ),
|
||||||
|
m_textCtrlConstraintYBinder( aParent, m_staticTextConstraintY, m_textCtrlConstraintY,
|
||||||
|
m_TextConstraintYUnits ),
|
||||||
m_textCtrlPosXBinder( aParent, m_staticTextPosX, m_textCtrlPosX, m_TextPosXUnits ),
|
m_textCtrlPosXBinder( aParent, m_staticTextPosX, m_textCtrlPosX, m_TextPosXUnits ),
|
||||||
m_textCtrlPosYBinder( aParent, m_staticTextPosY, m_textCtrlPosY, m_TextPosYUnits ),
|
m_textCtrlPosYBinder( aParent, m_staticTextPosY, m_textCtrlPosY, m_TextPosYUnits ),
|
||||||
m_textCtrlEndXBinder( aParent, m_staticTextEndX, m_textCtrlEndX, m_TextEndXUnits ),
|
m_textCtrlEndXBinder( aParent, m_staticTextEndX, m_textCtrlEndX, m_TextEndXUnits ),
|
||||||
m_textCtrlEndYBinder( aParent, m_staticTextEndY, m_textCtrlEndY, m_TextEndYUnits ),
|
m_textCtrlEndYBinder( aParent, m_staticTextEndY, m_textCtrlEndY, m_TextEndYUnits ),
|
||||||
m_textCtrlStepXBinder( aParent, m_staticTextStepX, m_textCtrlStepX, m_TextStepXUnits ),
|
m_textCtrlStepXBinder( aParent, m_staticTextStepX, m_textCtrlStepX, m_TextStepXUnits ),
|
||||||
m_textCtrlStepYBinder( aParent, m_staticTextStepY, m_textCtrlStepY, m_TextStepYUnits ),
|
m_textCtrlStepYBinder( aParent, m_staticTextStepY, m_textCtrlStepY, m_TextStepYUnits ),
|
||||||
m_textCtrlDefaultTextSizeXBinder( aParent, m_staticTextDefTsX, m_textCtrlDefaultTextSizeX, m_TextDefaultTextSizeXUnits ),
|
m_textCtrlDefaultTextSizeXBinder( aParent, m_staticTextDefTsX, m_textCtrlDefaultTextSizeX,
|
||||||
m_textCtrlDefaultTextSizeYBinder( aParent, m_staticTextDefTsY, m_textCtrlDefaultTextSizeY, m_TextDefaultTextSizeYUnits ),
|
m_TextDefaultTextSizeXUnits ),
|
||||||
m_textCtrlDefaultLineWidthBinder( aParent, m_staticTextDefLineW, m_textCtrlDefaultLineWidth, m_TextDefaultLineWidthUnits ),
|
m_textCtrlDefaultTextSizeYBinder( aParent, m_staticTextDefTsY, m_textCtrlDefaultTextSizeY,
|
||||||
m_textCtrlDefaultTextThicknessBinder( aParent, m_staticTextDefTextThickness, m_textCtrlDefaultTextThickness, m_TextDefaultTextThicknessUnits ),
|
m_TextDefaultTextSizeYUnits ),
|
||||||
m_textCtrlLeftMarginBinder( aParent, m_staticTextLeftMargin, m_textCtrlLeftMargin, m_TextLeftMarginUnits ),
|
m_textCtrlDefaultLineWidthBinder( aParent, m_staticTextDefLineW,
|
||||||
m_textCtrlRightMarginBinder( aParent, m_staticTextDefRightMargin, m_textCtrlRightMargin, m_TextRightMarginUnits ),
|
m_textCtrlDefaultLineWidth, m_TextDefaultLineWidthUnits ),
|
||||||
m_textCtrlTopMarginBinder( aParent, m_staticTextTopMargin, m_textCtrlTopMargin, m_TextTopMarginUnits ),
|
m_textCtrlDefaultTextThicknessBinder( aParent, m_staticTextDefTextThickness,
|
||||||
m_textCtrlBottomMarginBinder( aParent, m_staticTextBottomMargin, m_textCtrlBottomMargin, m_TextBottomMarginUnits ),
|
m_textCtrlDefaultTextThickness,
|
||||||
m_textCtrlThicknessBinder( aParent, m_staticTextThickness, m_textCtrlThickness, m_TextLineThicknessUnits )
|
m_TextDefaultTextThicknessUnits ),
|
||||||
|
m_textCtrlLeftMarginBinder( aParent, m_staticTextLeftMargin, m_textCtrlLeftMargin,
|
||||||
|
m_TextLeftMarginUnits ),
|
||||||
|
m_textCtrlRightMarginBinder( aParent, m_staticTextDefRightMargin, m_textCtrlRightMargin,
|
||||||
|
m_TextRightMarginUnits ),
|
||||||
|
m_textCtrlTopMarginBinder( aParent, m_staticTextTopMargin, m_textCtrlTopMargin,
|
||||||
|
m_TextTopMarginUnits ),
|
||||||
|
m_textCtrlBottomMarginBinder( aParent, m_staticTextBottomMargin, m_textCtrlBottomMargin,
|
||||||
|
m_TextBottomMarginUnits ),
|
||||||
|
m_textCtrlThicknessBinder( aParent, m_staticTextThickness, m_textCtrlThickness,
|
||||||
|
m_TextLineThicknessUnits )
|
||||||
{
|
{
|
||||||
m_parent = aParent;
|
m_parent = aParent;
|
||||||
|
|
||||||
|
@ -102,7 +116,6 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Data transfer from general properties to widgets
|
|
||||||
void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
||||||
{
|
{
|
||||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
@ -120,13 +133,17 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
||||||
m_textCtrlDefaultTextThicknessBinder.SetDoubleValue(
|
m_textCtrlDefaultTextThicknessBinder.SetDoubleValue(
|
||||||
From_User_Unit( EDA_UNITS::MILLIMETRES, model.m_DefaultTextThickness ) );
|
From_User_Unit( EDA_UNITS::MILLIMETRES, model.m_DefaultTextThickness ) );
|
||||||
|
|
||||||
m_textCtrlLeftMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetLeftMargin() ) );
|
m_textCtrlLeftMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
m_textCtrlRightMarginBinder.SetDoubleValue(From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetRightMargin() ) );
|
model.GetLeftMargin() ) );
|
||||||
m_textCtrlTopMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetTopMargin() ) );
|
m_textCtrlRightMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
m_textCtrlBottomMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetBottomMargin() ) );
|
model.GetRightMargin() ) );
|
||||||
|
m_textCtrlTopMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
|
model.GetTopMargin() ) );
|
||||||
|
m_textCtrlBottomMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
|
model.GetBottomMargin() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data transfer from widgets to general properties
|
|
||||||
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
||||||
{
|
{
|
||||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
@ -159,7 +176,6 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Data transfer from item to widgets in properties frame
|
|
||||||
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( !aItem )
|
if( !aItem )
|
||||||
|
@ -221,6 +237,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
|
DS_DATA_ITEM_TEXT* item = static_cast<DS_DATA_ITEM_TEXT*>( aItem );
|
||||||
item->m_FullText = item->m_TextBase;
|
item->m_FullText = item->m_TextBase;
|
||||||
|
|
||||||
// Replace our '\' 'n' sequence by the EOL char
|
// Replace our '\' 'n' sequence by the EOL char
|
||||||
item->ReplaceAntiSlashSequence();
|
item->ReplaceAntiSlashSequence();
|
||||||
m_stcText->SetValue( item->m_FullText );
|
m_stcText->SetValue( item->m_FullText );
|
||||||
|
@ -266,6 +283,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
|
||||||
{
|
{
|
||||||
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
||||||
|
|
||||||
// Rotation (poly and text)
|
// Rotation (poly and text)
|
||||||
msg.Printf( wxT("%.3f"), item->m_Orient );
|
msg.Printf( wxT("%.3f"), item->m_Orient );
|
||||||
m_textCtrlRotation->SetValue( msg );
|
m_textCtrlRotation->SetValue( msg );
|
||||||
|
@ -274,6 +292,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
||||||
{
|
{
|
||||||
DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
|
DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
|
||||||
|
|
||||||
// select definition in PPI
|
// select definition in PPI
|
||||||
msg.Printf( wxT("%d"), item->GetPPI() );
|
msg.Printf( wxT("%d"), item->GetPPI() );
|
||||||
m_textCtrlBitmapDPI->SetValue( msg );
|
m_textCtrlBitmapDPI->SetValue( msg );
|
||||||
|
@ -284,7 +303,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
m_SizerTextOptions->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
|
m_SizerTextOptions->Show( aItem->GetType() == DS_DATA_ITEM::DS_TEXT );
|
||||||
|
|
||||||
m_sbSizerEndPosition->Show( aItem->GetType() == DS_DATA_ITEM::DS_SEGMENT
|
m_sbSizerEndPosition->Show( aItem->GetType() == DS_DATA_ITEM::DS_SEGMENT
|
||||||
|| aItem->GetType() == DS_DATA_ITEM::DS_RECT );
|
|| aItem->GetType() == DS_DATA_ITEM::DS_RECT );
|
||||||
|
|
||||||
m_textCtrlThicknessBinder.Show( aItem->GetType() != DS_DATA_ITEM::DS_BITMAP );
|
m_textCtrlThicknessBinder.Show( aItem->GetType() != DS_DATA_ITEM::DS_BITMAP );
|
||||||
|
|
||||||
|
@ -324,13 +343,13 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
// until the frame is resized). Joys of multiplatform dev.
|
// until the frame is resized). Joys of multiplatform dev.
|
||||||
m_swItemProperties->Fit();
|
m_swItemProperties->Fit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send a size event to be sure scrollbars will be added/removed as needed
|
// send a size event to be sure scrollbars will be added/removed as needed
|
||||||
m_swItemProperties->PostSizeEvent();
|
m_swItemProperties->PostSizeEvent();
|
||||||
m_swItemProperties->Refresh();
|
m_swItemProperties->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Event function called by clicking on the OK button
|
|
||||||
void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
PL_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
|
PL_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
|
||||||
|
@ -344,6 +363,7 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DS_DATA_ITEM* dataItem = drawItem->GetPeer();
|
DS_DATA_ITEM* dataItem = drawItem->GetPeer();
|
||||||
CopyPrmsFromPanelToItem( dataItem );
|
CopyPrmsFromPanelToItem( dataItem );
|
||||||
|
|
||||||
// Be sure what is displayed is what is set for item
|
// Be sure what is displayed is what is set for item
|
||||||
// (mainly, texts can be modified if they contain "\n")
|
// (mainly, texts can be modified if they contain "\n")
|
||||||
CopyPrmsFromItemToPanel( dataItem );
|
CopyPrmsFromItemToPanel( dataItem );
|
||||||
|
@ -379,10 +399,9 @@ void PROPERTIES_FRAME::OnSetDefaultValues( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Data transfer from properties frame to item parameters
|
|
||||||
bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( aItem == NULL )
|
if( aItem == nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -399,7 +418,8 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import thickness
|
// Import thickness
|
||||||
aItem->m_LineWidth = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlThicknessBinder.GetValue() );
|
aItem->m_LineWidth = To_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
|
m_textCtrlThicknessBinder.GetValue() );
|
||||||
|
|
||||||
// Import Start point
|
// Import Start point
|
||||||
aItem->m_Pos.m_Pos.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlPosXBinder.GetValue() );
|
aItem->m_Pos.m_Pos.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlPosXBinder.GetValue() );
|
||||||
|
@ -431,8 +451,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
msg.ToLong( &itmp );
|
msg.ToLong( &itmp );
|
||||||
aItem->m_RepeatCount = itmp;
|
aItem->m_RepeatCount = itmp;
|
||||||
|
|
||||||
aItem->m_IncrementVector.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepXBinder.GetValue() );
|
aItem->m_IncrementVector.x = To_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
aItem->m_IncrementVector.y = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepYBinder.GetValue() );
|
m_textCtrlStepXBinder.GetValue() );
|
||||||
|
aItem->m_IncrementVector.y = To_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||||
|
m_textCtrlStepYBinder.GetValue() );
|
||||||
|
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
|
||||||
{
|
{
|
||||||
|
@ -456,7 +478,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
|
|
||||||
switch( m_choiceVjustify->GetSelection() )
|
switch( m_choiceVjustify->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0: item->m_Vjustify = GR_TEXT_VJUSTIFY_TOP; break;
|
case 0: item->m_Vjustify = GR_TEXT_VJUSTIFY_TOP; break;
|
||||||
case 1: item->m_Vjustify = GR_TEXT_VJUSTIFY_CENTER; break;
|
case 1: item->m_Vjustify = GR_TEXT_VJUSTIFY_CENTER; break;
|
||||||
case 2: item->m_Vjustify = GR_TEXT_VJUSTIFY_BOTTOM; break;
|
case 2: item->m_Vjustify = GR_TEXT_VJUSTIFY_BOTTOM; break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 CERN
|
* Copyright (C) 2013 CERN
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -49,42 +50,41 @@ static struct IFACE : public KIFACE_I
|
||||||
|
|
||||||
void OnKifaceEnd() override;
|
void OnKifaceEnd() override;
|
||||||
|
|
||||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
|
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||||
|
int aCtlBits = 0 ) override
|
||||||
{
|
{
|
||||||
switch( aClassId )
|
switch( aClassId )
|
||||||
{
|
{
|
||||||
case FRAME_PL_EDITOR:
|
case FRAME_PL_EDITOR:
|
||||||
{
|
{
|
||||||
PL_EDITOR_FRAME* frame = new PL_EDITOR_FRAME( aKiway, aParent );
|
PL_EDITOR_FRAME* frame = new PL_EDITOR_FRAME( aKiway, aParent );
|
||||||
return frame;
|
return frame;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IfaceOrAddress
|
* Return a pointer to the requested object.
|
||||||
* return a pointer to the requested object. The safest way to use this
|
*
|
||||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
* The safest way to use this is to retrieve a pointer to a static instance of an interface,
|
||||||
* how the KIFACE interface is exported. But if you know what you are doing
|
* similar to how the KIFACE interface is exported. But if you know what you are doing
|
||||||
* use it to retrieve anything you want.
|
* use it to retrieve anything you want.
|
||||||
*
|
*
|
||||||
* @param aDataId identifies which object you want the address of.
|
* @param aDataId identifies which object you want the address of.
|
||||||
*
|
* @return the object requested and must be cast into the know type.
|
||||||
* @return void* - and must be cast into the know type.
|
|
||||||
*/
|
*/
|
||||||
void* IfaceOrAddress( int aDataId ) override
|
void* IfaceOrAddress( int aDataId ) override
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveFileAs
|
|
||||||
* Saving a file under a different name is delegated to the various KIFACEs because
|
* Saving a file under a different name is delegated to the various KIFACEs because
|
||||||
* the project doesn't know the internal format of the various files (which may have
|
* the project doesn't know the internal format of the various files (which may have
|
||||||
* paths in them that need updating).
|
* paths in them that need updating).
|
||||||
|
@ -97,10 +97,13 @@ static struct IFACE : public KIFACE_I
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
using namespace PGE;
|
using namespace PGE;
|
||||||
|
|
||||||
|
|
||||||
static PGM_BASE* process;
|
static PGM_BASE* process;
|
||||||
|
|
||||||
|
|
||||||
KIFACE_I& Kiface() { return kiface; }
|
KIFACE_I& Kiface() { return kiface; }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2011 jean-pierre.charras
|
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||||
* Copyright (C) 1992-2021 Kicad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -76,13 +76,15 @@ public:
|
||||||
{
|
{
|
||||||
// add new item an try to keep alphabetic order,
|
// add new item an try to keep alphabetic order,
|
||||||
// and because name have numbers inside, use a KiCad compare function
|
// and because name have numbers inside, use a KiCad compare function
|
||||||
// that handles number as numbers not ascii chars
|
// that handles number as numbers not ASCII chars
|
||||||
unsigned ii = 0;
|
unsigned ii = 0;
|
||||||
|
|
||||||
for( ; ii < m_List.size(); ii++ )
|
for( ; ii < m_List.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( UTIL::RefDesStringCompare( aItem->m_Name, m_List[ii]->m_Name ) < 0 )
|
if( UTIL::RefDesStringCompare( aItem->m_Name, m_List[ii]->m_Name ) < 0 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_List.insert( m_List.begin() + ii, aItem );
|
m_List.insert( m_List.begin() + ii, aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ public:
|
||||||
return m_List[ii];
|
return m_List[ii];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove( const wxString & aRegName )
|
void Remove( const wxString & aRegName )
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras
|
* Copyright (C) 2016 Jean-Pierre Charras
|
||||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -50,7 +50,7 @@ bool PCB_CALCULATOR_FRAME::ReadDataFile()
|
||||||
{
|
{
|
||||||
FILE* file = wxFopen( GetDataFilename(), wxT( "rt" ) );
|
FILE* file = wxFopen( GetDataFilename(), wxT( "rt" ) );
|
||||||
|
|
||||||
if( file == NULL )
|
if( file == nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Switch the locale to standard C (needed to read/write floating point numbers)
|
// Switch the locale to standard C (needed to read/write floating point numbers)
|
||||||
|
@ -84,6 +84,7 @@ bool PCB_CALCULATOR_FRAME::ReadDataFile()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_CALCULATOR_FRAME::WriteDataFile()
|
bool PCB_CALCULATOR_FRAME::WriteDataFile()
|
||||||
{
|
{
|
||||||
// Switch the locale to standard C (needed to read/write floating point numbers)
|
// Switch the locale to standard C (needed to read/write floating point numbers)
|
||||||
|
@ -117,11 +118,13 @@ PCB_CALCULATOR_DATAFILE::PCB_CALCULATOR_DATAFILE( REGULATOR_LIST * aList )
|
||||||
m_list = aList;
|
m_list = aList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char* regtype_str[] =
|
static const char* regtype_str[] =
|
||||||
{
|
{
|
||||||
"normal", "3terminal"
|
"normal", "3terminal"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int PCB_CALCULATOR_DATAFILE::WriteHeader( OUTPUTFORMATTER* aFormatter ) const
|
int PCB_CALCULATOR_DATAFILE::WriteHeader( OUTPUTFORMATTER* aFormatter ) const
|
||||||
{
|
{
|
||||||
int nestlevel = 0;
|
int nestlevel = 0;
|
||||||
|
@ -141,6 +144,7 @@ void PCB_CALCULATOR_DATAFILE::Format( OUTPUTFORMATTER* aFormatter,
|
||||||
{
|
{
|
||||||
// Write regulators list:
|
// Write regulators list:
|
||||||
aFormatter->Print( aNestLevel++, "(%s\n", getTokenName( T_regulators ) );
|
aFormatter->Print( aNestLevel++, "(%s\n", getTokenName( T_regulators ) );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_list->m_List.size(); ii++ )
|
for( unsigned ii = 0; ii < m_list->m_List.size(); ii++ )
|
||||||
{
|
{
|
||||||
REGULATOR_DATA * item = m_list->m_List[ii];
|
REGULATOR_DATA * item = m_list->m_List[ii];
|
||||||
|
@ -148,15 +152,18 @@ void PCB_CALCULATOR_DATAFILE::Format( OUTPUTFORMATTER* aFormatter,
|
||||||
aFormatter->Quotew(item->m_Name ).c_str() );
|
aFormatter->Quotew(item->m_Name ).c_str() );
|
||||||
aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_vref ),
|
aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_vref ),
|
||||||
item->m_Vref );
|
item->m_Vref );
|
||||||
|
|
||||||
if( item->m_Iadj != 0 && item->m_Type == 1)
|
if( item->m_Iadj != 0 && item->m_Type == 1)
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_iadj ),
|
aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_iadj ),
|
||||||
item->m_Iadj );
|
item->m_Iadj );
|
||||||
}
|
}
|
||||||
|
|
||||||
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_reg_type ),
|
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_reg_type ),
|
||||||
regtype_str[item->m_Type] );
|
regtype_str[item->m_Type] );
|
||||||
aFormatter->Print( aNestLevel, ")\n" );
|
aFormatter->Print( aNestLevel, ")\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
aFormatter->Print( --aNestLevel, ")\n" );
|
aFormatter->Print( --aNestLevel, ")\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,16 +174,14 @@ void PCB_CALCULATOR_DATAFILE::Parse( PCB_CALCULATOR_DATAFILE_PARSER* aParser )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// PCB_CALCULATOR_DATAFILE_PARSER
|
|
||||||
|
|
||||||
PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( LINE_READER* aReader ) :
|
PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( LINE_READER* aReader ) :
|
||||||
PCB_CALCULATOR_DATAFILE_LEXER( aReader )
|
PCB_CALCULATOR_DATAFILE_LEXER( aReader )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( char* aLine, const wxString& aSource ) :
|
PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( char* aLine,
|
||||||
|
const wxString& aSource ) :
|
||||||
PCB_CALCULATOR_DATAFILE_LEXER( aLine, aSource )
|
PCB_CALCULATOR_DATAFILE_LEXER( aLine, aSource )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -185,6 +190,7 @@ PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( char* aLine, con
|
||||||
void PCB_CALCULATOR_DATAFILE_PARSER::Parse( PCB_CALCULATOR_DATAFILE* aDataList )
|
void PCB_CALCULATOR_DATAFILE_PARSER::Parse( PCB_CALCULATOR_DATAFILE* aDataList )
|
||||||
{
|
{
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
while( ( token = NextTok() ) != T_EOF)
|
while( ( token = NextTok() ) != T_EOF)
|
||||||
{
|
{
|
||||||
if( token == T_LEFT )
|
if( token == T_LEFT )
|
||||||
|
@ -200,6 +206,7 @@ void PCB_CALCULATOR_DATAFILE_PARSER::Parse( PCB_CALCULATOR_DATAFILE* aDataList )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFILE* aDataList )
|
void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFILE* aDataList )
|
||||||
{
|
{
|
||||||
T token;
|
T token;
|
||||||
|
@ -236,28 +243,34 @@ void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFIL
|
||||||
{
|
{
|
||||||
case T_reg_vref: // the voltage reference value
|
case T_reg_vref: // the voltage reference value
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
|
|
||||||
if( token != T_NUMBER )
|
if( token != T_NUMBER )
|
||||||
Expecting( T_NUMBER );
|
Expecting( T_NUMBER );
|
||||||
|
|
||||||
sscanf( CurText(), "%lf" , &vref);
|
sscanf( CurText(), "%lf" , &vref);
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_reg_iadj: // the Iadj reference value
|
case T_reg_iadj: // the Iadj reference value
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
|
|
||||||
if( token != T_NUMBER )
|
if( token != T_NUMBER )
|
||||||
Expecting( T_NUMBER );
|
Expecting( T_NUMBER );
|
||||||
|
|
||||||
sscanf( CurText(), "%lf" , &iadj);
|
sscanf( CurText(), "%lf" , &iadj);
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_reg_type: // type: normal or 3 terminal reg
|
case T_reg_type: // type: normal or 3 terminal reg
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
if( strcasecmp( CurText(), regtype_str[0] ) == 0 )
|
|
||||||
|
if( strcasecmp( CurText(), regtype_str[0] ) == 0 )
|
||||||
type = 0;
|
type = 0;
|
||||||
else if( strcasecmp( CurText(), regtype_str[1] ) == 0 )
|
else if( strcasecmp( CurText(), regtype_str[1] ) == 0 )
|
||||||
type = 1;
|
type = 1;
|
||||||
else
|
else
|
||||||
Unexpected( CurText() );
|
Unexpected( CurText() );
|
||||||
|
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -271,7 +284,8 @@ void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFIL
|
||||||
{
|
{
|
||||||
if( type != 1 )
|
if( type != 1 )
|
||||||
iadj = 0.0;
|
iadj = 0.0;
|
||||||
REGULATOR_DATA * new_item = new REGULATOR_DATA(name, vref, type, iadj );
|
|
||||||
|
REGULATOR_DATA* new_item = new REGULATOR_DATA( name, vref, type, iadj );
|
||||||
aDataList->m_list->Add( new_item );
|
aDataList->m_list->Add( new_item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 jean-pierre.charras
|
* Copyright (C) 2015 jean-pierre.charras
|
||||||
* Copyright (C) 2015 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -26,10 +26,7 @@
|
||||||
#include "pcb_calculator_settings.h"
|
#include "pcb_calculator_settings.h"
|
||||||
|
|
||||||
// Pcb_calculator data file extension:
|
// Pcb_calculator data file extension:
|
||||||
const wxString PcbCalcDataFileExt( wxT("pcbcalc") );
|
const wxString PcbCalcDataFileExt( wxT( "pcbcalc" ) );
|
||||||
|
|
||||||
|
|
||||||
// PCB_CALCULATOR_APP
|
|
||||||
|
|
||||||
|
|
||||||
namespace PCBCALC {
|
namespace PCBCALC {
|
||||||
|
@ -46,35 +43,38 @@ static struct IFACE : public KIFACE_I
|
||||||
|
|
||||||
void OnKifaceEnd() override;
|
void OnKifaceEnd() override;
|
||||||
|
|
||||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
|
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||||
|
int aCtlBits = 0 ) override
|
||||||
{
|
{
|
||||||
return new PCB_CALCULATOR_FRAME( aKiway, aParent );
|
return new PCB_CALCULATOR_FRAME( aKiway, aParent );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IfaceOrAddress
|
* Return a pointer to the requested object.
|
||||||
* return a pointer to the requested object. The safest way to use this
|
*
|
||||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
* The safest way to use this is to retrieve a pointer to a static instance of an interface,
|
||||||
* how the KIFACE interface is exported. But if you know what you are doing
|
* similar to how the KIFACE interface is exported. But if you know what you are doing
|
||||||
* use it to retrieve anything you want.
|
* use it to retrieve anything you want.
|
||||||
*
|
*
|
||||||
* @param aDataId identifies which object you want the address of.
|
* @param aDataId identifies which object you want the address of.
|
||||||
*
|
* @return the requested object and must be cast into the know type.
|
||||||
* @return void* - and must be cast into the know type.
|
|
||||||
*/
|
*/
|
||||||
void* IfaceOrAddress( int aDataId ) override
|
void* IfaceOrAddress( int aDataId ) override
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} kiface( "pcb_calculator", KIWAY::FACE_PCB_CALCULATOR );
|
} kiface( "pcb_calculator", KIWAY::FACE_PCB_CALCULATOR );
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
using namespace PCBCALC;
|
using namespace PCBCALC;
|
||||||
|
|
||||||
static PGM_BASE* process;
|
static PGM_BASE* process;
|
||||||
|
|
||||||
|
|
||||||
KIFACE_I& Kiface() { return kiface; }
|
KIFACE_I& Kiface() { return kiface; }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2015 jean-pierre.charras
|
* Copyright (C) 1992-2015 jean-pierre.charras
|
||||||
* Copyright (C) 1992-2020 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
|
|
||||||
// extension of pcb_calculator data filename:
|
// extension of pcb_calculator data filename:
|
||||||
const wxString DataFileNameExt( wxT("pcbcalc") );
|
const wxString DataFileNameExt( wxT( "pcbcalc" ) );
|
||||||
|
|
||||||
|
|
||||||
PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
PCB_CALCULATOR_FRAME_BASE( aParent ),
|
PCB_CALCULATOR_FRAME_BASE( aParent ),
|
||||||
|
@ -40,9 +41,9 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_bpButtonSynthetize->SetBitmap( KiBitmap( BITMAPS::small_up ) );
|
m_bpButtonSynthetize->SetBitmap( KiBitmap( BITMAPS::small_up ) );
|
||||||
|
|
||||||
SetKiway( this, aKiway );
|
SetKiway( this, aKiway );
|
||||||
m_currTransLine = NULL;
|
m_currTransLine = nullptr;
|
||||||
m_currTransLineType = DEFAULT_TYPE;
|
m_currTransLineType = DEFAULT_TYPE;
|
||||||
m_currAttenuator = NULL;
|
m_currAttenuator = nullptr;
|
||||||
m_RegulatorListChanged = false;
|
m_RegulatorListChanged = false;
|
||||||
m_TWMode = TW_MASTER_CURRENT;
|
m_TWMode = TW_MASTER_CURRENT;
|
||||||
m_TWNested = false;
|
m_TWNested = false;
|
||||||
|
@ -52,16 +53,16 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
// Populate transline list ordered like in dialog menu list
|
// Populate transline list ordered like in dialog menu list
|
||||||
const static TRANSLINE_TYPE_ID tltype_list[8] =
|
const static TRANSLINE_TYPE_ID tltype_list[8] =
|
||||||
{
|
{
|
||||||
MICROSTRIP_TYPE,
|
MICROSTRIP_TYPE,
|
||||||
CPW_TYPE,
|
CPW_TYPE,
|
||||||
GROUNDED_CPW_TYPE,
|
GROUNDED_CPW_TYPE,
|
||||||
RECTWAVEGUIDE_TYPE,
|
RECTWAVEGUIDE_TYPE,
|
||||||
COAX_TYPE,
|
COAX_TYPE,
|
||||||
C_MICROSTRIP_TYPE,
|
C_MICROSTRIP_TYPE,
|
||||||
STRIPLINE_TYPE,
|
STRIPLINE_TYPE,
|
||||||
TWISTEDPAIR_TYPE
|
TWISTEDPAIR_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
for( int ii = 0; ii < 8; ii++ )
|
for( int ii = 0; ii < 8; ii++ )
|
||||||
m_transline_list.push_back( new TRANSLINE_IDENT( tltype_list[ii] ) );
|
m_transline_list.push_back( new TRANSLINE_IDENT( tltype_list[ii] ) );
|
||||||
|
@ -277,7 +278,7 @@ void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event )
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
{
|
{
|
||||||
if( aCfg == NULL )
|
if( aCfg == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||||
|
@ -321,7 +322,7 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
|
|
||||||
void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
{
|
{
|
||||||
if( aCfg == NULL )
|
if( aCfg == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
@ -355,11 +356,6 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnTranslineAnalyse
|
|
||||||
* Run a new analyse for the current transline with current parameters
|
|
||||||
* and displays the electrical parameters
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTranslineAnalyse( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTranslineAnalyse( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( m_currTransLine )
|
if( m_currTransLine )
|
||||||
|
@ -370,11 +366,6 @@ void PCB_CALCULATOR_FRAME::OnTranslineAnalyse( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnTranslineSynthetize
|
|
||||||
* Run a new synthezis for the current transline with current parameters
|
|
||||||
* and displays the geometrical parameters
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTranslineSynthetize( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTranslineSynthetize( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( m_currTransLine )
|
if( m_currTransLine )
|
||||||
|
@ -385,9 +376,6 @@ void PCB_CALCULATOR_FRAME::OnTranslineSynthetize( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* returns the full filename of the selected pcb_calculator data file
|
|
||||||
* the extension file is forced
|
|
||||||
*/
|
|
||||||
const wxString PCB_CALCULATOR_FRAME::GetDataFilename()
|
const wxString PCB_CALCULATOR_FRAME::GetDataFilename()
|
||||||
{
|
{
|
||||||
if( m_regulators_fileNameCtrl->GetValue().IsEmpty() )
|
if( m_regulators_fileNameCtrl->GetValue().IsEmpty() )
|
||||||
|
@ -399,15 +387,12 @@ const wxString PCB_CALCULATOR_FRAME::GetDataFilename()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the full filename of the selected pcb_calculator data file
|
void PCB_CALCULATOR_FRAME::SetDataFilename( const wxString& aFilename )
|
||||||
* force the standard extension of the file (.pcbcalc)
|
|
||||||
* aFilename = the full filename, with or without extension
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::SetDataFilename( const wxString & aFilename)
|
|
||||||
{
|
{
|
||||||
if( aFilename.IsEmpty() )
|
if( aFilename.IsEmpty() )
|
||||||
|
{
|
||||||
m_regulators_fileNameCtrl->SetValue( wxEmptyString );
|
m_regulators_fileNameCtrl->SetValue( wxEmptyString );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFileName fn( aFilename );
|
wxFileName fn( aFilename );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2011 jean-pierre.charras
|
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||||
* Copyright (C) 1992-2020 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -63,21 +63,22 @@ void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
||||||
{
|
{
|
||||||
switch( m_choiceRegType->GetSelection() )
|
switch( m_choiceRegType->GetSelection() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
m_bitmapRegul4pins->Show( true );
|
m_bitmapRegul4pins->Show( true );
|
||||||
m_bitmapRegul3pins->Show( false );
|
m_bitmapRegul3pins->Show( false );
|
||||||
m_RegulIadjValue->Enable( false );
|
m_RegulIadjValue->Enable( false );
|
||||||
m_RegulFormula->SetLabel( wxT( "Vout = Vref * (R1 + R2) / R2" ) );
|
m_RegulFormula->SetLabel( wxT( "Vout = Vref * (R1 + R2) / R2" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
m_bitmapRegul4pins->Show( false );
|
m_bitmapRegul4pins->Show( false );
|
||||||
m_bitmapRegul3pins->Show( true );
|
m_bitmapRegul3pins->Show( true );
|
||||||
m_RegulIadjValue->Enable( true );
|
m_RegulIadjValue->Enable( true );
|
||||||
m_RegulFormula->SetLabel( wxT( "Vout = Vref * (R1 + R2) / R1 + Iadj * R2" ) );
|
m_RegulFormula->SetLabel( wxT( "Vout = Vref * (R1 + R2) / R1 + Iadj * R2" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The new icon size must be taken in account
|
// The new icon size must be taken in account
|
||||||
m_panelRegulators->GetSizer()->Layout();
|
m_panelRegulators->GetSizer()->Layout();
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||||
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
m_lastSelectedRegulatorName = item->m_Name;
|
m_lastSelectedRegulatorName = item->m_Name;
|
||||||
|
@ -111,16 +113,12 @@ void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
||||||
m_RegulIadjValue->SetValue( value );
|
m_RegulIadjValue->SetValue( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call RegulatorPageUpdate to enable/sisable tools,
|
// Call RegulatorPageUpdate to enable/disable tools,
|
||||||
// even if no item selected
|
// even if no item selected
|
||||||
RegulatorPageUpdate();
|
RegulatorPageUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Called when ckicking on button Browse:
|
|
||||||
* Select a new data file, and load it on request
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString fullfilename = GetDataFilename();
|
wxString fullfilename = GetDataFilename();
|
||||||
|
@ -143,6 +141,7 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetDataFilename( fullfilename );
|
SetDataFilename( fullfilename );
|
||||||
|
|
||||||
if( wxFileExists( fullfilename ) && m_RegulatorList.GetCount() > 0 ) // Read file
|
if( wxFileExists( fullfilename ) && m_RegulatorList.GetCount() > 0 ) // Read file
|
||||||
{
|
{
|
||||||
if( wxMessageBox( _("Do you want to load this file and replace current regulator list?" ) )
|
if( wxMessageBox( _("Do you want to load this file and replace current regulator list?" ) )
|
||||||
|
@ -157,7 +156,6 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||||
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
||||||
SelectLastSelectedRegulator();
|
SelectLastSelectedRegulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -172,6 +170,7 @@ void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
||||||
DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
|
DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !dlg.IsOK() )
|
if( !dlg.IsOK() )
|
||||||
{
|
{
|
||||||
wxMessageBox( _("Bad or missing parameters!") );
|
wxMessageBox( _("Bad or missing parameters!") );
|
||||||
|
@ -181,7 +180,7 @@ void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
||||||
REGULATOR_DATA * new_item = dlg.BuildRegulatorFromData();
|
REGULATOR_DATA * new_item = dlg.BuildRegulatorFromData();
|
||||||
|
|
||||||
// Add new item, if not existing
|
// Add new item, if not existing
|
||||||
if( m_RegulatorList.GetReg( new_item->m_Name ) == NULL )
|
if( m_RegulatorList.GetReg( new_item->m_Name ) == nullptr )
|
||||||
{
|
{
|
||||||
// Add item in list
|
// Add item in list
|
||||||
m_RegulatorList.Add( new_item );
|
m_RegulatorList.Add( new_item );
|
||||||
|
@ -203,12 +202,14 @@ void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||||
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
||||||
if( item == NULL )
|
|
||||||
|
if( item == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DIALOG_REGULATOR_FORM dlg( this, name );
|
DIALOG_REGULATOR_FORM dlg( this, name );
|
||||||
|
|
||||||
dlg.CopyRegulatorDataToDialog( item );
|
dlg.CopyRegulatorDataToDialog( item );
|
||||||
|
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -232,6 +233,7 @@ void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
||||||
m_RegulatorListChanged = true;
|
m_RegulatorListChanged = true;
|
||||||
m_choiceRegulatorSelector->Clear();
|
m_choiceRegulatorSelector->Clear();
|
||||||
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
||||||
|
|
||||||
if( m_lastSelectedRegulatorName == name )
|
if( m_lastSelectedRegulatorName == name )
|
||||||
m_lastSelectedRegulatorName.Empty();
|
m_lastSelectedRegulatorName.Empty();
|
||||||
|
|
||||||
|
@ -243,14 +245,17 @@ void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
||||||
{
|
{
|
||||||
// Find last selected in regulator list:
|
// Find last selected in regulator list:
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
if( ! m_lastSelectedRegulatorName.IsEmpty() )
|
|
||||||
|
if( !m_lastSelectedRegulatorName.IsEmpty() )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < m_RegulatorList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_RegulatorList.GetCount(); ii++ )
|
||||||
|
{
|
||||||
if( m_RegulatorList.m_List[ii]->m_Name == m_lastSelectedRegulatorName )
|
if( m_RegulatorList.m_List[ii]->m_Name == m_lastSelectedRegulatorName )
|
||||||
{
|
{
|
||||||
idx = ii;
|
idx = ii;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_choiceRegulatorSelector->SetSelection( idx );
|
m_choiceRegulatorSelector->SetSelection( idx );
|
||||||
|
@ -259,18 +264,22 @@ void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calculate a value from the 3 other values
|
|
||||||
// Vref is given by the regulator properties, so
|
|
||||||
// we can calculate only R1, R2 or Vout
|
|
||||||
void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
if( m_rbRegulR1->GetValue() )
|
if( m_rbRegulR1->GetValue() )
|
||||||
|
{
|
||||||
id = 0; // for R1 calculation
|
id = 0; // for R1 calculation
|
||||||
|
}
|
||||||
else if( m_rbRegulR2->GetValue() )
|
else if( m_rbRegulR2->GetValue() )
|
||||||
|
{
|
||||||
id = 1; // for R2 calculation
|
id = 1; // for R2 calculation
|
||||||
|
}
|
||||||
else if( m_rbRegulVout->GetValue() )
|
else if( m_rbRegulVout->GetValue() )
|
||||||
|
{
|
||||||
id = 2; // for Vout calculation
|
id = 2; // for Vout calculation
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMessageBox( wxT("Selection error" ) );
|
wxMessageBox( wxT("Selection error" ) );
|
||||||
|
@ -297,9 +306,8 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
||||||
txt = m_RegulVoutValue->GetValue();
|
txt = m_RegulVoutValue->GetValue();
|
||||||
vout = DoubleFromString(txt);
|
vout = DoubleFromString(txt);
|
||||||
|
|
||||||
|
|
||||||
// Some tests:
|
// Some tests:
|
||||||
if( vout < vref && id != 2)
|
if( vout < vref && id != 2 )
|
||||||
{
|
{
|
||||||
m_RegulMessage->SetLabel( _("Vout must be greater than vref" ) );
|
m_RegulMessage->SetLabel( _("Vout must be greater than vref" ) );
|
||||||
return;
|
return;
|
||||||
|
@ -307,11 +315,11 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
||||||
|
|
||||||
if( vref == 0.0 )
|
if( vref == 0.0 )
|
||||||
{
|
{
|
||||||
m_RegulMessage->SetLabel( _("Vref set to 0 !" ) );
|
m_RegulMessage->SetLabel( _( "Vref set to 0 !" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (r1 < 0 && id != 0 ) || (r2 <= 0 && id != 1) )
|
if( ( r1 < 0 && id != 0 ) || ( r2 <= 0 && id != 1 ) )
|
||||||
{
|
{
|
||||||
m_RegulMessage->SetLabel( _("Incorrect value for R1 R2" ) );
|
m_RegulMessage->SetLabel( _("Incorrect value for R1 R2" ) );
|
||||||
return;
|
return;
|
||||||
|
@ -323,52 +331,45 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
||||||
// 3 terminal regulator
|
// 3 terminal regulator
|
||||||
txt = m_RegulIadjValue->GetValue();
|
txt = m_RegulIadjValue->GetValue();
|
||||||
double iadj = DoubleFromString(txt);
|
double iadj = DoubleFromString(txt);
|
||||||
|
|
||||||
// iadj is given in micro amp, so convert it in amp.
|
// iadj is given in micro amp, so convert it in amp.
|
||||||
iadj /= 1000000;
|
iadj /= 1000000;
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
r1 = vref * r2 / ( vout - vref - (r2 * iadj) );
|
r1 = vref * r2 / ( vout - vref - ( r2 * iadj ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
r2 = ( vout - vref ) / ( iadj + (vref/r1) );
|
r2 = ( vout - vref ) / ( iadj + ( vref / r1 ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
vout = vref * (r1 + r2) / r1;
|
vout = vref * ( r1 + r2 ) / r1;
|
||||||
vout += r2 * iadj;
|
vout += r2 * iadj;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Standard 4 terminal regulator
|
{ // Standard 4 terminal regulator
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: r1 = ( vout / vref - 1 ) * r2; break;
|
||||||
r1 = ( vout / vref - 1 ) * r2;
|
case 1: r2 = r1 / ( vout / vref - 1 ); break;
|
||||||
break;
|
case 2: vout = vref * ( r1 + r2 ) / r2; break;
|
||||||
|
|
||||||
case 1:
|
|
||||||
r2 = r1 / ( vout / vref - 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
vout = vref * (r1 + r2) / r2;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// write values to panel:
|
|
||||||
txt.Printf(wxT("%g"), r1 / r1scale );
|
|
||||||
m_RegulR1Value->SetValue(txt);
|
|
||||||
txt.Printf(wxT("%g"), r2 / r2scale);
|
|
||||||
m_RegulR2Value->SetValue(txt);
|
|
||||||
txt.Printf(wxT("%g"), vref);
|
|
||||||
m_RegulVrefValue->SetValue(txt);
|
|
||||||
txt.Printf(wxT("%g"), vout);
|
|
||||||
m_RegulVoutValue->SetValue(txt);
|
|
||||||
|
|
||||||
|
// write values to panel:
|
||||||
|
txt.Printf( wxT( "%g" ), r1 / r1scale );
|
||||||
|
m_RegulR1Value->SetValue( txt );
|
||||||
|
txt.Printf( wxT( "%g" ), r2 / r2scale );
|
||||||
|
m_RegulR2Value->SetValue( txt );
|
||||||
|
txt.Printf( wxT( "%g" ), vref );
|
||||||
|
m_RegulVrefValue->SetValue( txt );
|
||||||
|
txt.Printf( wxT( "%g" ), vout );
|
||||||
|
m_RegulVoutValue->SetValue( txt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 jean-pierre.charras
|
* Copyright (C) 2011 jean-pierre.charras
|
||||||
* Copyright (C) 1992-2020 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -35,7 +35,7 @@ extern double DoubleFromString( const wxString& TextValue );
|
||||||
|
|
||||||
// A helper function to find the choice in a list of values
|
// A helper function to find the choice in a list of values
|
||||||
// return true if a index in aList that matches aValue is found.
|
// return true if a index in aList that matches aValue is found.
|
||||||
static bool findMatch(wxArrayString& aList, const wxString& aValue, int& aIdx )
|
static bool findMatch( wxArrayString& aList, const wxString& aValue, int& aIdx )
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
// Find the previous choice index:
|
// Find the previous choice index:
|
||||||
|
@ -108,11 +108,6 @@ static bool findMatch(wxArrayString& aList, const wxString& aValue, int& aIdx )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnEpsilonR_Button
|
|
||||||
* Shows a list of current relative dielectric constant(Er)
|
|
||||||
* and set the selected value in main dialog frame
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxArrayString list = StandardRelativeDielectricConstantList();
|
wxArrayString list = StandardRelativeDielectricConstantList();
|
||||||
|
@ -131,11 +126,6 @@ void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnTanD_Button
|
|
||||||
* Shows a list of current dielectric loss factor (tangent delta)
|
|
||||||
* and set the selected value in main dialog frame
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxArrayString list = StandardLossTangentList();
|
wxArrayString list = StandardLossTangentList();
|
||||||
|
@ -147,18 +137,13 @@ void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
|
||||||
findMatch( list, prevChoiceStr, prevChoice );
|
findMatch( list, prevChoiceStr, prevChoice );
|
||||||
|
|
||||||
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Dielectric Loss Factor" ), list,
|
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Dielectric Loss Factor" ), list,
|
||||||
prevChoice, NULL );
|
prevChoice, nullptr );
|
||||||
|
|
||||||
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
||||||
m_Value_TanD->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
m_Value_TanD->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnTranslineRho_Button
|
|
||||||
* Shows a list of current Specific resistance list (rho)
|
|
||||||
* and set the selected value in main dialog frame
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxArrayString list = StandardResistivityList();
|
wxArrayString list = StandardResistivityList();
|
||||||
|
@ -170,7 +155,7 @@ void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event )
|
||||||
findMatch( list, prevChoiceStr, prevChoice );
|
findMatch( list, prevChoiceStr, prevChoice );
|
||||||
|
|
||||||
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Specific Resistance" ), list,
|
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Specific Resistance" ), list,
|
||||||
prevChoice, NULL );
|
prevChoice, nullptr );
|
||||||
|
|
||||||
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
||||||
m_Value_Rho->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
m_Value_Rho->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
||||||
|
@ -186,14 +171,6 @@ struct DLG_PRM_DATA
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function TranslineTypeSelection
|
|
||||||
* Must be called after selection of a new transline.
|
|
||||||
* Update all values, labels and tool tips of parameters needed
|
|
||||||
* by the new transline
|
|
||||||
* Irrelevant parameters texts are blanked.
|
|
||||||
* @param aType = the transline_type_id of the new selected transline
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType )
|
void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType )
|
||||||
{
|
{
|
||||||
m_currTransLineType = aType;
|
m_currTransLineType = aType;
|
||||||
|
@ -221,17 +198,19 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
wxStaticText* left_msg_list[] =
|
wxStaticText* left_msg_list[] =
|
||||||
{
|
{
|
||||||
m_left_message1, m_left_message2, m_left_message3, m_left_message4, m_left_message5,
|
m_left_message1, m_left_message2, m_left_message3, m_left_message4, m_left_message5,
|
||||||
m_left_message6, m_left_message7, NULL
|
m_left_message6, m_left_message7, nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
wxStaticText* msg_list[] =
|
wxStaticText* msg_list[] =
|
||||||
{
|
{
|
||||||
m_Message1, m_Message2, m_Message3, m_Message4, m_Message5, m_Message6, m_Message7, NULL
|
m_Message1, m_Message2, m_Message3, m_Message4, m_Message5, m_Message6, m_Message7, nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned jj = 0;
|
unsigned jj = 0;
|
||||||
|
|
||||||
for( ; jj < tr_ident->m_Messages.GetCount(); jj++ )
|
for( ; jj < tr_ident->m_Messages.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
if( left_msg_list[jj] == NULL )
|
if( left_msg_list[jj] == nullptr )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
left_msg_list[jj]->SetLabel( tr_ident->m_Messages[jj] );
|
left_msg_list[jj]->SetLabel( tr_ident->m_Messages[jj] );
|
||||||
|
@ -246,12 +225,12 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Init parameters dialog items
|
// Init parameters dialog items
|
||||||
struct DLG_PRM_DATA substrateprms[] =
|
struct DLG_PRM_DATA substrateprms[] =
|
||||||
{
|
{
|
||||||
{ m_EpsilonR_label, m_Value_EpsilonR, NULL },
|
{ m_EpsilonR_label, m_Value_EpsilonR, nullptr },
|
||||||
{ m_TanD_label, m_Value_TanD, NULL },
|
{ m_TanD_label, m_Value_TanD, nullptr },
|
||||||
{ m_Rho_label, m_Value_Rho, NULL },
|
{ m_Rho_label, m_Value_Rho, nullptr },
|
||||||
{ m_substrate_prm4_label, m_Substrate_prm4_Value, m_SubsPrm4_choiceUnit },
|
{ m_substrate_prm4_label, m_Substrate_prm4_Value, m_SubsPrm4_choiceUnit },
|
||||||
{ m_substrate_prm5_label, m_Substrate_prm5_Value, m_SubsPrm5_choiceUnit },
|
{ m_substrate_prm5_label, m_Substrate_prm5_Value, m_SubsPrm5_choiceUnit },
|
||||||
{ m_substrate_prm6_label, m_Substrate_prm6_Value, m_SubsPrm6_choiceUnit },
|
{ m_substrate_prm6_label, m_Substrate_prm6_Value, m_SubsPrm6_choiceUnit },
|
||||||
|
@ -259,7 +238,8 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
{ m_substrate_prm8_label, m_Substrate_prm8_Value, m_SubsPrm8_choiceUnit },
|
{ m_substrate_prm8_label, m_Substrate_prm8_Value, m_SubsPrm8_choiceUnit },
|
||||||
{ m_substrate_prm9_label, m_Substrate_prm9_Value, m_SubsPrm9_choiceUnit }
|
{ m_substrate_prm9_label, m_Substrate_prm9_Value, m_SubsPrm9_choiceUnit }
|
||||||
};
|
};
|
||||||
#define substrateprms_cnt (sizeof(substrateprms)/sizeof(substrateprms[0]))
|
|
||||||
|
#define substrateprms_cnt (sizeof(substrateprms)/sizeof(substrateprms[0]))
|
||||||
|
|
||||||
struct DLG_PRM_DATA physprms[] =
|
struct DLG_PRM_DATA physprms[] =
|
||||||
{
|
{
|
||||||
|
@ -267,7 +247,8 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
{ m_phys_prm2_label, m_Phys_prm2_Value, m_choiceUnit_Param2 },
|
{ m_phys_prm2_label, m_Phys_prm2_Value, m_choiceUnit_Param2 },
|
||||||
{ m_phys_prm3_label, m_Phys_prm3_Value, m_choiceUnit_Param3 }
|
{ m_phys_prm3_label, m_Phys_prm3_Value, m_choiceUnit_Param3 }
|
||||||
};
|
};
|
||||||
#define physprms_cnt (sizeof(physprms)/sizeof(physprms[0]))
|
|
||||||
|
#define physprms_cnt (sizeof(physprms)/sizeof(physprms[0]))
|
||||||
|
|
||||||
struct DLG_PRM_DATA elecprms[] =
|
struct DLG_PRM_DATA elecprms[] =
|
||||||
{
|
{
|
||||||
|
@ -275,13 +256,15 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
{ m_elec_prm2_label, m_Elec_prm2_Value, m_choiceUnit_ElecPrm2 },
|
{ m_elec_prm2_label, m_Elec_prm2_Value, m_choiceUnit_ElecPrm2 },
|
||||||
{ m_elec_prm3_label, m_Elec_prm3_Value, m_choiceUnit_ElecPrm3 }
|
{ m_elec_prm3_label, m_Elec_prm3_Value, m_choiceUnit_ElecPrm3 }
|
||||||
};
|
};
|
||||||
#define elecprms_cnt (sizeof(elecprms)/sizeof(elecprms[0]))
|
|
||||||
|
#define elecprms_cnt (sizeof(elecprms)/sizeof(elecprms[0]))
|
||||||
|
|
||||||
struct DLG_PRM_DATA frequencyprms[] =
|
struct DLG_PRM_DATA frequencyprms[] =
|
||||||
{
|
{
|
||||||
{ m_Frequency_label,m_Value_Frequency_Ctrl, m_choiceUnit_Frequency }
|
{ m_Frequency_label,m_Value_Frequency_Ctrl, m_choiceUnit_Frequency }
|
||||||
};
|
};
|
||||||
#define frequencyprms_cnt (sizeof(frequencyprms)/sizeof(frequencyprms[0]))
|
|
||||||
|
#define frequencyprms_cnt (sizeof(frequencyprms)/sizeof(frequencyprms[0]))
|
||||||
|
|
||||||
unsigned idxsubs = 0;
|
unsigned idxsubs = 0;
|
||||||
unsigned idxphys = 0;
|
unsigned idxphys = 0;
|
||||||
|
@ -291,7 +274,8 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
for( unsigned ii = 0; ii < tr_ident->GetPrmsCount(); ii++ )
|
for( unsigned ii = 0; ii < tr_ident->GetPrmsCount(); ii++ )
|
||||||
{
|
{
|
||||||
TRANSLINE_PRM* prm = tr_ident->GetPrm( ii );
|
TRANSLINE_PRM* prm = tr_ident->GetPrm( ii );
|
||||||
struct DLG_PRM_DATA * data = NULL;
|
struct DLG_PRM_DATA * data = nullptr;
|
||||||
|
|
||||||
switch( prm->m_Type )
|
switch( prm->m_Type )
|
||||||
{
|
{
|
||||||
case PRM_TYPE_SUBS:
|
case PRM_TYPE_SUBS:
|
||||||
|
@ -408,11 +392,7 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function TransfDlgDataToTranslineParams
|
|
||||||
* Read values entered in dialog frame, and copy these values
|
|
||||||
* in current transline parameters, converted in normalized units
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::TransfDlgDataToTranslineParams()
|
void PCB_CALCULATOR_FRAME::TransfDlgDataToTranslineParams()
|
||||||
{
|
{
|
||||||
TRANSLINE_IDENT* tr_ident = m_transline_list[m_currTransLineType];
|
TRANSLINE_IDENT* tr_ident = m_transline_list[m_currTransLineType];
|
||||||
|
@ -437,10 +417,6 @@ void PCB_CALCULATOR_FRAME::TransfDlgDataToTranslineParams()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnTranslineSelection
|
|
||||||
* Called on new transmission line selection
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTranslineSelection( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTranslineSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
enum TRANSLINE_TYPE_ID id = (enum TRANSLINE_TYPE_ID) event.GetSelection();
|
enum TRANSLINE_TYPE_ID id = (enum TRANSLINE_TYPE_ID) event.GetSelection();
|
||||||
|
@ -454,11 +430,6 @@ void PCB_CALCULATOR_FRAME::OnTranslineSelection( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnTransLineResetButtonClick
|
|
||||||
* Called when the user clicks the reset button. This sets
|
|
||||||
* the parameters to their default values.
|
|
||||||
*/
|
|
||||||
void PCB_CALCULATOR_FRAME::OnTransLineResetButtonClick( wxCommandEvent& event )
|
void PCB_CALCULATOR_FRAME::OnTransLineResetButtonClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
TranslineTypeSelection( DEFAULT_TYPE );
|
TranslineTypeSelection( DEFAULT_TYPE );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2014 Jean-Pierre Charras
|
* Copyright (C) 2011-2014 Jean-Pierre Charras
|
||||||
* Copyright (C) 2004-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -42,16 +42,9 @@
|
||||||
#include "transline_ident.h"
|
#include "transline_ident.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId, const char* aKeywordCfg,
|
||||||
* TRANSLINE_PRM
|
const wxString& aDlgLabel, const wxString& aToolTip,
|
||||||
* A class to handle one parameter of transline
|
double aValue, bool aConvUnit )
|
||||||
*/
|
|
||||||
TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
|
||||||
const char* aKeywordCfg,
|
|
||||||
const wxString& aDlgLabel,
|
|
||||||
const wxString& aToolTip,
|
|
||||||
double aValue,
|
|
||||||
bool aConvUnit )
|
|
||||||
{
|
{
|
||||||
m_Type = aType;
|
m_Type = aType;
|
||||||
m_Id = aId;
|
m_Id = aId;
|
||||||
|
@ -60,8 +53,8 @@ TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
||||||
m_ToolTip = aToolTip;
|
m_ToolTip = aToolTip;
|
||||||
m_Value = aValue;
|
m_Value = aValue;
|
||||||
m_ConvUnit = aConvUnit;
|
m_ConvUnit = aConvUnit;
|
||||||
m_ValueCtrl = NULL;
|
m_ValueCtrl = nullptr;
|
||||||
m_UnitCtrl = NULL;
|
m_UnitCtrl = nullptr;
|
||||||
m_UnitSelection = 0;
|
m_UnitSelection = 0;
|
||||||
m_NormalizedValue = 0;
|
m_NormalizedValue = 0;
|
||||||
}
|
}
|
||||||
|
@ -85,23 +78,11 @@ double TRANSLINE_PRM::FromUserUnit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TRANSLINE_IDENT
|
|
||||||
* A class to handle a list of parameters of a given transline
|
|
||||||
* Important note:
|
|
||||||
* the first string of TRANSLINE_PRM (m_KeyWord) is a keyword in config file.
|
|
||||||
* it can contain only ASCII7 chars
|
|
||||||
* the second string of TRANSLINE_PRM (m_DlgLabel) is a string translated for dialog,
|
|
||||||
* so mark it for translation (m_KeyWord and m_DlgLabel are usually the same in English)
|
|
||||||
* and of course do not mark translatable m_DlgLabel that obviously cannot be translated,
|
|
||||||
* like "H" or "H_t"
|
|
||||||
*/
|
|
||||||
|
|
||||||
TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
{
|
{
|
||||||
m_Type = aType; // The type of transline handled
|
m_Type = aType; // The type of transline handled
|
||||||
m_Icon = NULL; // An xpm icon to display in dialogs
|
m_Icon = nullptr; // An xpm icon to display in dialogs
|
||||||
m_TLine = NULL; // The TRANSLINE itself
|
m_TLine = nullptr; // The TRANSLINE itself
|
||||||
m_HasPrmSelection = false; // true if selection of parameters must be enabled in dialog menu
|
m_HasPrmSelection = false; // true if selection of parameters must be enabled in dialog menu
|
||||||
|
|
||||||
// Add common prms:
|
// Add common prms:
|
||||||
|
@ -118,7 +99,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
// Default value is for copper
|
// Default value is for copper
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, RHO_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, RHO_PRM,
|
||||||
"Rho", wxT( "ρ" ),
|
"Rho", wxT( "ρ" ),
|
||||||
_( "Electrical resistivity or specific electrical resistance of conductor (ohm*meter)" ),
|
_( "Electrical resistivity or specific electrical resistance of "
|
||||||
|
"conductor (ohm*meter)" ),
|
||||||
1.72e-8, false ) );
|
1.72e-8, false ) );
|
||||||
|
|
||||||
// Default value is in GHz
|
// Default value is in GHz
|
||||||
|
@ -149,10 +131,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
"Rough", _( "Roughness" ),
|
"Rough", _( "Roughness" ),
|
||||||
_( "Conductor roughness" ), 0.0, true ) );
|
_( "Conductor roughness" ), 0.0, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MUR_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MUR_PRM,
|
||||||
"mu Rel S", wxString::Format( wxT( "μ(%s)" ), _( "substrate" ) ),
|
"mu Rel S", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "substrate" ) ),
|
||||||
_( "Relative permeability (mu) of substrate" ), 1, false ) );
|
_( "Relative permeability (mu) of substrate" ), 1, false ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
|
@ -183,7 +167,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
||||||
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
|
@ -216,7 +201,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
||||||
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
|
@ -248,10 +234,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
m_Messages.Add( _( "TM-modes:" ) );
|
m_Messages.Add( _( "TM-modes:" ) );
|
||||||
|
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MUR_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MUR_PRM,
|
||||||
"mu Rel I", wxString::Format( wxT( "μ(%s)" ), _( "insulator" ) ),
|
"mu Rel I", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "insulator" ) ),
|
||||||
_( "Relative permeability (mu) of insulator" ), 1, false ) );
|
_( "Relative permeability (mu) of insulator" ), 1, false ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
|
@ -281,10 +269,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
m_Messages.Add( _( "TM-modes:" ) );
|
m_Messages.Add( _( "TM-modes:" ) );
|
||||||
|
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MUR_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MUR_PRM,
|
||||||
"mu Rel I", wxString::Format( wxT( "μ(%s)" ), _( "insulator" ) ),
|
"mu Rel I", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "insulator" ) ),
|
||||||
_( "Relative permeability (mu) of insulator" ), 1, false ) );
|
_( "Relative permeability (mu) of insulator" ), 1, false ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
|
@ -327,7 +317,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
"Rough", _( "Roughness" ),
|
"Rough", _( "Roughness" ),
|
||||||
_( "Conductor roughness" ), 0.0, true ) );
|
_( "Conductor roughness" ), 0.0, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
|
@ -340,10 +331,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
|
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_E_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_E_PRM,
|
||||||
"Zeven", _( "Zeven" ),
|
"Zeven", _( "Zeven" ),
|
||||||
_( "Even mode impedance (lines driven by common voltages)" ), 50.0, true ) );
|
_( "Even mode impedance (lines driven by common voltages)" ),
|
||||||
|
50.0, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_O_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_O_PRM,
|
||||||
"Zodd", _( "Zodd" ),
|
"Zodd", _( "Zodd" ),
|
||||||
_( "Odd mode impedance (lines driven by opposite (differential) voltages)" ), 50.0, true ) );
|
_( "Odd mode impedance (lines driven by opposite "
|
||||||
|
"(differential) voltages)" ), 50.0, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, ANG_L_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, ANG_L_PRM,
|
||||||
"Ang_l", "Ang_l",
|
"Ang_l", "Ang_l",
|
||||||
_( "Electrical length" ), 0.0, true ) );
|
_( "Electrical length" ), 0.0, true ) );
|
||||||
|
@ -366,7 +359,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
||||||
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1, false ) );
|
_( "Relative permeability (mu) of conductor" ), 1, false ) );
|
||||||
|
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_PHYS, PHYS_WIDTH_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_PHYS, PHYS_WIDTH_PRM,
|
||||||
|
@ -395,11 +389,13 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
||||||
"Twists", _( "Twists" ),
|
"Twists", _( "Twists" ),
|
||||||
_( "Number of twists per length" ), 0.0, false ) );
|
_( "Number of twists per length" ), 0.0, false ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, MURC_PRM,
|
||||||
"mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
|
"mu Rel C", wxString::Format( wxT( "μ(%s)" ),
|
||||||
|
_( "conductor" ) ),
|
||||||
_( "Relative permeability (mu) of conductor" ), 1,
|
_( "Relative permeability (mu) of conductor" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, TWISTEDPAIR_EPSILONR_ENV_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, TWISTEDPAIR_EPSILONR_ENV_PRM,
|
||||||
"ErEnv", wxString::Format( wxT( "εr(%s)" ), _( "environment" ) ),
|
"ErEnv", wxString::Format( wxT( "εr(%s)" ),
|
||||||
|
_( "environment" ) ),
|
||||||
_( "Relative permittivity of environment" ), 1,
|
_( "Relative permittivity of environment" ), 1,
|
||||||
false ) );
|
false ) );
|
||||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_PHYS, PHYS_DIAM_IN_PRM,
|
AddPrm( new TRANSLINE_PRM( PRM_TYPE_PHYS, PHYS_DIAM_IN_PRM,
|
||||||
|
|
|
@ -53,6 +53,10 @@ enum PRM_TYPE {
|
||||||
PRM_TYPE_FREQUENCY
|
PRM_TYPE_FREQUENCY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class to handle one parameter of transline.
|
||||||
|
*/
|
||||||
class TRANSLINE_PRM
|
class TRANSLINE_PRM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -62,12 +66,10 @@ public:
|
||||||
* @param aDlgLabel is a I18n string used to identify the parameter in dialog.
|
* @param aDlgLabel is a I18n string used to identify the parameter in dialog.
|
||||||
* usually aDlgLabel is same as aKeywordCfg, but translatable.
|
* usually aDlgLabel is same as aKeywordCfg, but translatable.
|
||||||
*/
|
*/
|
||||||
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId, const char* aKeywordCfg = "",
|
||||||
const char* aKeywordCfg = "",
|
|
||||||
const wxString& aDlgLabel = wxEmptyString,
|
const wxString& aDlgLabel = wxEmptyString,
|
||||||
const wxString& aToolTip = wxEmptyString,
|
const wxString& aToolTip = wxEmptyString,
|
||||||
double aValue = 0.0,
|
double aValue = 0.0, bool aConvUnit = false );
|
||||||
bool aConvUnit = false );
|
|
||||||
|
|
||||||
double ToUserUnit();
|
double ToUserUnit();
|
||||||
double FromUserUnit();
|
double FromUserUnit();
|
||||||
|
@ -86,8 +88,14 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// A class to handle the list of available transm. lines
|
/**
|
||||||
// with messages, tooptips ...
|
* A class to handle a list of parameters of a given transline.
|
||||||
|
*
|
||||||
|
* @note The first string of TRANSLINE_PRM (m_KeyWord) is a keyword in config file.
|
||||||
|
* It can contain only ASCII7 chars. The second string of TRANSLINE_PRM is a
|
||||||
|
* string translated for dialog so mark it for translation. Do not mark translatable
|
||||||
|
* m_DlgLabel that obviously cannot be translated, like "H" or "H_t".
|
||||||
|
*/
|
||||||
class TRANSLINE_IDENT
|
class TRANSLINE_IDENT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -105,7 +113,7 @@ public:
|
||||||
if( aIdx < m_prms_List.size() )
|
if( aIdx < m_prms_List.size() )
|
||||||
return m_prms_List[aIdx];
|
return m_prms_List[aIdx];
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned GetPrmsCount() const
|
unsigned GetPrmsCount() const
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2017 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2017 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -52,24 +53,41 @@
|
||||||
|
|
||||||
// read and instantiate an IDF component outline
|
// read and instantiate an IDF component outline
|
||||||
static SCENEGRAPH* loadIDFOutline( const wxString& aFileName );
|
static SCENEGRAPH* loadIDFOutline( const wxString& aFileName );
|
||||||
|
|
||||||
|
|
||||||
// read and render an IDF board assembly
|
// read and render an IDF board assembly
|
||||||
static SCENEGRAPH* loadIDFBoard( const wxString& aFileName );
|
static SCENEGRAPH* loadIDFBoard( const wxString& aFileName );
|
||||||
|
|
||||||
|
|
||||||
// model a single extruded outline
|
// model a single extruded outline
|
||||||
// idxColor = color index to use
|
// idxColor = color index to use
|
||||||
// aParent = parent SCENEGRAPH object, if any
|
// aParent = parent SCENEGRAPH object, if any
|
||||||
static SCENEGRAPH* addOutline( IDF3_COMP_OUTLINE* outline, int idxColor, SGNODE* aParent );
|
static SCENEGRAPH* addOutline( IDF3_COMP_OUTLINE* outline, int idxColor, SGNODE* aParent );
|
||||||
|
|
||||||
|
|
||||||
// model the board extrusion
|
// model the board extrusion
|
||||||
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent );
|
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent );
|
||||||
|
|
||||||
|
|
||||||
// model all included components
|
// model all included components
|
||||||
static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent );
|
static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent );
|
||||||
|
|
||||||
|
|
||||||
// model any .OTHER_OUTLINE items
|
// model any .OTHER_OUTLINE items
|
||||||
static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent );
|
static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent );
|
||||||
|
|
||||||
|
|
||||||
// convert the IDF outline to VRML intermediate data
|
// convert the IDF outline to VRML intermediate data
|
||||||
static bool getOutlineModel( VRML_LAYER& model, const std::list< IDF_OUTLINE* >* items );
|
static bool getOutlineModel( VRML_LAYER& model, const std::list< IDF_OUTLINE* >* items );
|
||||||
|
|
||||||
|
|
||||||
// convert IDF segment data to VRML segment data
|
// convert IDF segment data to VRML segment data
|
||||||
static bool addSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg );
|
static bool addSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg );
|
||||||
|
|
||||||
|
|
||||||
// convert the VRML intermediate data into SG* data
|
// convert the VRML intermediate data into SG* data
|
||||||
static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, double top, double bottom );
|
static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, double top,
|
||||||
|
double bottom );
|
||||||
|
|
||||||
|
|
||||||
class LOCALESWITCH
|
class LOCALESWITCH
|
||||||
|
@ -105,63 +123,63 @@ static SGNODE* getColor( IFSG_SHAPE& shape, int colorIdx )
|
||||||
// green for PCB
|
// green for PCB
|
||||||
material.SetSpecular( 0.13f, 0.81f, 0.22f );
|
material.SetSpecular( 0.13f, 0.81f, 0.22f );
|
||||||
material.SetDiffuse( 0.13f, 0.81f, 0.22f );
|
material.SetDiffuse( 0.13f, 0.81f, 0.22f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// magenta
|
// magenta
|
||||||
material.SetSpecular( 0.8f, 0.0f, 0.8f );
|
material.SetSpecular( 0.8f, 0.0f, 0.8f );
|
||||||
material.SetDiffuse( 0.6f, 0.0f, 0.6f );
|
material.SetDiffuse( 0.6f, 0.0f, 0.6f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
// red
|
// red
|
||||||
material.SetSpecular( 0.69f, 0.14f, 0.14f );
|
material.SetSpecular( 0.69f, 0.14f, 0.14f );
|
||||||
material.SetDiffuse( 0.69f, 0.14f, 0.14f );
|
material.SetDiffuse( 0.69f, 0.14f, 0.14f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// orange
|
// orange
|
||||||
material.SetSpecular( 1.0f, 0.44f, 0.0f );
|
material.SetSpecular( 1.0f, 0.44f, 0.0f );
|
||||||
material.SetDiffuse( 1.0f, 0.44f, 0.0f );
|
material.SetDiffuse( 1.0f, 0.44f, 0.0f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
// yellow
|
// yellow
|
||||||
material.SetSpecular( 0.93f, 0.94f, 0.16f );
|
material.SetSpecular( 0.93f, 0.94f, 0.16f );
|
||||||
material.SetDiffuse( 0.93f, 0.94f, 0.16f );
|
material.SetDiffuse( 0.93f, 0.94f, 0.16f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
// blue
|
// blue
|
||||||
material.SetSpecular( 0.1f, 0.11f, 0.88f );
|
material.SetSpecular( 0.1f, 0.11f, 0.88f );
|
||||||
material.SetDiffuse( 0.1f, 0.11f, 0.88f );
|
material.SetDiffuse( 0.1f, 0.11f, 0.88f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// violet
|
// violet
|
||||||
material.SetSpecular( 0.32f, 0.07f, 0.64f );
|
material.SetSpecular( 0.32f, 0.07f, 0.64f );
|
||||||
material.SetDiffuse( 0.32f, 0.07f, 0.64f );
|
material.SetDiffuse( 0.32f, 0.07f, 0.64f );
|
||||||
|
|
||||||
// default ambient intensity
|
// default ambient intensity
|
||||||
material.SetShininess( 0.3f );
|
material.SetShininess( 0.3f );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,8 +196,8 @@ const char* GetKicadPluginName( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GetPluginVersion( unsigned char* Major,
|
void GetPluginVersion( unsigned char* Major, unsigned char* Minor, unsigned char* Patch,
|
||||||
unsigned char* Minor, unsigned char* Patch, unsigned char* Revision )
|
unsigned char* Revision )
|
||||||
{
|
{
|
||||||
if( Major )
|
if( Major )
|
||||||
*Major = PLUGIN_3D_IDF_MAJOR;
|
*Major = PLUGIN_3D_IDF_MAJOR;
|
||||||
|
@ -192,10 +210,9 @@ void GetPluginVersion( unsigned char* Major,
|
||||||
|
|
||||||
if( Revision )
|
if( Revision )
|
||||||
*Revision = PLUGIN_3D_IDF_REVNO;
|
*Revision = PLUGIN_3D_IDF_REVNO;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// number of extensions supported
|
// number of extensions supported
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define NEXTS 2
|
#define NEXTS 2
|
||||||
|
@ -203,12 +220,15 @@ void GetPluginVersion( unsigned char* Major,
|
||||||
#define NEXTS 4
|
#define NEXTS 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// number of filter sets supported
|
// number of filter sets supported
|
||||||
#define NFILS 2
|
#define NFILS 2
|
||||||
|
|
||||||
|
|
||||||
static char ext0[] = "idf";
|
static char ext0[] = "idf";
|
||||||
static char ext1[] = "emn";
|
static char ext1[] = "emn";
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static char fil0[] = "IDF (*.idf)|*.idf";
|
static char fil0[] = "IDF (*.idf)|*.idf";
|
||||||
static char fil1[] = "IDF BRD v2/v3 (*.emn)|*.emn";
|
static char fil1[] = "IDF BRD v2/v3 (*.emn)|*.emn";
|
||||||
|
@ -235,8 +255,6 @@ static struct FILE_DATA
|
||||||
extensions[2] = ext2;
|
extensions[2] = ext2;
|
||||||
extensions[3] = ext3;
|
extensions[3] = ext3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} file_data;
|
} file_data;
|
||||||
|
@ -251,7 +269,7 @@ int GetNExtensions( void )
|
||||||
char const* GetModelExtension( int aIndex )
|
char const* GetModelExtension( int aIndex )
|
||||||
{
|
{
|
||||||
if( aIndex < 0 || aIndex >= NEXTS )
|
if( aIndex < 0 || aIndex >= NEXTS )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return file_data.extensions[aIndex];
|
return file_data.extensions[aIndex];
|
||||||
}
|
}
|
||||||
|
@ -266,7 +284,7 @@ int GetNFilters( void )
|
||||||
char const* GetFileFilter( int aIndex )
|
char const* GetFileFilter( int aIndex )
|
||||||
{
|
{
|
||||||
if( aIndex < 0 || aIndex >= NFILS )
|
if( aIndex < 0 || aIndex >= NFILS )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return file_data.filters[aIndex];
|
return file_data.filters[aIndex];
|
||||||
}
|
}
|
||||||
|
@ -281,15 +299,15 @@ bool CanRender( void )
|
||||||
|
|
||||||
SCENEGRAPH* Load( char const* aFileName )
|
SCENEGRAPH* Load( char const* aFileName )
|
||||||
{
|
{
|
||||||
if( NULL == aFileName )
|
if( nullptr == aFileName )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
wxFileName fname;
|
wxFileName fname;
|
||||||
fname.Assign( wxString::FromUTF8Unchecked( aFileName ) );
|
fname.Assign( wxString::FromUTF8Unchecked( aFileName ) );
|
||||||
|
|
||||||
wxString ext = fname.GetExt();
|
wxString ext = fname.GetExt();
|
||||||
|
|
||||||
SCENEGRAPH* data = NULL;
|
SCENEGRAPH* data = nullptr;
|
||||||
|
|
||||||
if( !ext.Cmp( wxT( "idf" ) ) || !ext.Cmp( wxT( "IDF" ) ) )
|
if( !ext.Cmp( wxT( "idf" ) ) || !ext.Cmp( wxT( "IDF" ) ) )
|
||||||
{
|
{
|
||||||
|
@ -302,16 +320,16 @@ SCENEGRAPH* Load( char const* aFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG: WRITE OUT IDF FILE TO CONFIRM NORMALS
|
// DEBUG: WRITE OUT IDF FILE TO CONFIRM NORMALS
|
||||||
#if defined( DEBUG_IDF ) && DEBUG_IDF > 3
|
#if defined( DEBUG_IDF ) && DEBUG_IDF > 3
|
||||||
if( data )
|
if( data )
|
||||||
{
|
{
|
||||||
wxFileName fn( aFileName );
|
wxFileName fn( aFileName );
|
||||||
wxString output = wxT( "_idf-" );
|
wxString output = wxT( "_idf-" );
|
||||||
output.append( fn.GetName() );
|
output.append( fn.GetName() );
|
||||||
output.append( wxT(".wrl") );
|
output.append( wxT( ".wrl" ) );
|
||||||
S3D::WriteVRML( output.ToUTF8(), true, (SGNODE*)(data), true, true );
|
S3D::WriteVRML( output.ToUTF8(), true, (SGNODE*) ( data ), true, true );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -339,28 +357,28 @@ static bool getOutlineModel( VRML_LAYER& model, const std::list< IDF_OUTLINE* >*
|
||||||
|
|
||||||
if( nvcont < 0 )
|
if( nvcont < 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] cannot create an outline";
|
ostr << " * [INFO] cannot create an outline";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (*scont)->size() < 1 )
|
if( (*scont)->size() < 1 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] invalid contour: no vertices";
|
ostr << " * [INFO] invalid contour: no vertices";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -369,20 +387,21 @@ static bool getOutlineModel( VRML_LAYER& model, const std::list< IDF_OUTLINE* >*
|
||||||
eseg = (*scont)->end();
|
eseg = (*scont)->end();
|
||||||
|
|
||||||
iseg = 0;
|
iseg = 0;
|
||||||
|
|
||||||
while( sseg != eseg )
|
while( sseg != eseg )
|
||||||
{
|
{
|
||||||
lseg = **sseg;
|
lseg = **sseg;
|
||||||
|
|
||||||
if( !addSegment( model, &lseg, nvcont, iseg ) )
|
if( !addSegment( model, &lseg, nvcont, iseg ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] cannot add segment";
|
ostr << " * [BUG] cannot add segment";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -409,14 +428,14 @@ static bool addSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg
|
||||||
{
|
{
|
||||||
if( iseg != 0 )
|
if( iseg != 0 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] adding a circle to an existing vertex list";
|
ostr << " * [INFO] adding a circle to an existing vertex list";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -437,9 +456,10 @@ static bool addSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, double top, double bottom )
|
static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, double top,
|
||||||
|
double bottom )
|
||||||
{
|
{
|
||||||
vpcb.Tesselate( NULL );
|
vpcb.Tesselate( nullptr );
|
||||||
std::vector< double > vertices;
|
std::vector< double > vertices;
|
||||||
std::vector< int > idxPlane;
|
std::vector< int > idxPlane;
|
||||||
std::vector< int > idxSide;
|
std::vector< int > idxSide;
|
||||||
|
@ -453,30 +473,30 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do
|
||||||
|
|
||||||
if( !vpcb.Get3DTriangles( vertices, idxPlane, idxSide, top, bottom ) )
|
if( !vpcb.Get3DTriangles( vertices, idxPlane, idxSide, top, bottom ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] no vertex data";
|
ostr << " * [INFO] no vertex data";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
|
if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] index lists are not a multiple of 3 (not a triangle list)";
|
ostr << " * [BUG] index lists are not a multiple of 3 (not a triangle list)";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< SGPOINT > vlist;
|
std::vector< SGPOINT > vlist;
|
||||||
|
@ -487,14 +507,24 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do
|
||||||
vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
|
vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
|
||||||
|
|
||||||
// create the intermediate scenegraph
|
// create the intermediate scenegraph
|
||||||
IFSG_TRANSFORM* tx0 = new IFSG_TRANSFORM( aParent ); // tx0 = Transform for this outline
|
IFSG_TRANSFORM* tx0 = new IFSG_TRANSFORM( aParent ); // tx0 = Transform for this outline
|
||||||
IFSG_SHAPE* shape = new IFSG_SHAPE( *tx0 ); // shape will hold (a) all vertices and (b) a local list of normals
|
|
||||||
IFSG_FACESET* face = new IFSG_FACESET( *shape ); // this face shall represent the top and bottom planes
|
// shape will hold (a) all vertices and (b) a local list of normals
|
||||||
IFSG_COORDS* cp = new IFSG_COORDS( *face ); // coordinates for all faces
|
IFSG_SHAPE* shape = new IFSG_SHAPE( *tx0 );
|
||||||
|
|
||||||
|
// this face shall represent the top and bottom planes
|
||||||
|
IFSG_FACESET* face = new IFSG_FACESET( *shape );
|
||||||
|
|
||||||
|
// coordinates for all faces
|
||||||
|
IFSG_COORDS* cp = new IFSG_COORDS( *face );
|
||||||
cp->SetCoordsList( nvert, &vlist[0] );
|
cp->SetCoordsList( nvert, &vlist[0] );
|
||||||
IFSG_COORDINDEX* coordIdx = new IFSG_COORDINDEX( *face ); // coordinate indices for top and bottom planes only
|
|
||||||
|
// coordinate indices for top and bottom planes only.
|
||||||
|
IFSG_COORDINDEX* coordIdx = new IFSG_COORDINDEX( *face );
|
||||||
coordIdx->SetIndices( idxPlane.size(), &idxPlane[0] );
|
coordIdx->SetIndices( idxPlane.size(), &idxPlane[0] );
|
||||||
IFSG_NORMALS* norms = new IFSG_NORMALS( *face ); // normals for the top and bottom planes
|
|
||||||
|
// normals for the top and bottom planes.
|
||||||
|
IFSG_NORMALS* norms = new IFSG_NORMALS( *face );
|
||||||
|
|
||||||
// number of TOP (and bottom) vertices
|
// number of TOP (and bottom) vertices
|
||||||
j = nvert / 2;
|
j = nvert / 2;
|
||||||
|
@ -573,16 +603,16 @@ static SCENEGRAPH* addOutline( IDF3_COMP_OUTLINE* outline, int idxColor, SGNODE*
|
||||||
|
|
||||||
if( !getOutlineModel( vpcb, outline->GetOutlines() ) )
|
if( !getOutlineModel( vpcb, outline->GetOutlines() ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] no valid outline data";
|
ostr << " * [INFO] no valid outline data";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
vpcb.EnsureWinding( 0, false );
|
vpcb.EnsureWinding( 0, false );
|
||||||
|
@ -607,13 +637,13 @@ static SCENEGRAPH* loadIDFOutline( const wxString& aFileName )
|
||||||
{
|
{
|
||||||
LOCALESWITCH switcher;
|
LOCALESWITCH switcher;
|
||||||
IDF3_BOARD brd( IDF3::CAD_ELEC );
|
IDF3_BOARD brd( IDF3::CAD_ELEC );
|
||||||
IDF3_COMP_OUTLINE* outline = NULL;
|
IDF3_COMP_OUTLINE* outline = nullptr;
|
||||||
|
|
||||||
outline = brd.GetComponentOutline( aFileName );
|
outline = brd.GetComponentOutline( aFileName );
|
||||||
|
|
||||||
if( NULL == outline )
|
if( nullptr == outline )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -623,12 +653,12 @@ static SCENEGRAPH* loadIDFOutline( const wxString& aFileName )
|
||||||
ostr << aFileName << "'";
|
ostr << aFileName << "'";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENEGRAPH* data = addOutline( outline, -1, NULL );
|
SCENEGRAPH* data = addOutline( outline, -1, nullptr );
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -642,7 +672,7 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
||||||
// note: if the IDF model is defective no outline substitutes shall be made
|
// note: if the IDF model is defective no outline substitutes shall be made
|
||||||
if( !brd.ReadFile( aFileName, true ) )
|
if( !brd.ReadFile( aFileName, true ) )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -651,9 +681,9 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
||||||
ostr << " * [INFO] IDF file '" << aFileName.ToUTF8() << "'";
|
ostr << " * [INFO] IDF file '" << aFileName.ToUTF8() << "'";
|
||||||
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_IDF, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFSG_TRANSFORM tx0( true );
|
IFSG_TRANSFORM tx0( true );
|
||||||
|
@ -663,7 +693,7 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
||||||
bool noComp = false;
|
bool noComp = false;
|
||||||
bool noOther = false;
|
bool noOther = false;
|
||||||
|
|
||||||
if( NULL == makeBoard( brd, topNode ) )
|
if( nullptr == makeBoard( brd, topNode ) )
|
||||||
noBoard = true;
|
noBoard = true;
|
||||||
|
|
||||||
if( !makeComponents( brd, topNode ) )
|
if( !makeComponents( brd, topNode ) )
|
||||||
|
@ -675,7 +705,7 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
||||||
if( noBoard && noComp && noOther )
|
if( noBoard && noComp && noOther )
|
||||||
{
|
{
|
||||||
tx0.Destroy();
|
tx0.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (SCENEGRAPH*) topNode;
|
return (SCENEGRAPH*) topNode;
|
||||||
|
@ -684,18 +714,18 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
||||||
|
|
||||||
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent )
|
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
VRML_LAYER vpcb;
|
VRML_LAYER vpcb;
|
||||||
|
|
||||||
// check if no board outline
|
// check if no board outline
|
||||||
if( brd.GetBoardOutlinesSize() < 1 )
|
if( brd.GetBoardOutlinesSize() < 1 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
|
|
||||||
if( !getOutlineModel( vpcb, brd.GetBoardOutline()->GetOutlines() ) )
|
if( !getOutlineModel( vpcb, brd.GetBoardOutline()->GetOutlines() ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
vpcb.EnsureWinding( 0, false );
|
vpcb.EnsureWinding( 0, false );
|
||||||
|
|
||||||
|
@ -747,7 +777,7 @@ static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
|
|
||||||
static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int ncomponents = 0;
|
int ncomponents = 0;
|
||||||
|
@ -798,28 +828,27 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
|
|
||||||
pout = (IDF3_COMP_OUTLINE*)((*so)->GetOutline());
|
pout = (IDF3_COMP_OUTLINE*)((*so)->GetOutline());
|
||||||
|
|
||||||
if( NULL == pout )
|
if( nullptr == pout )
|
||||||
{
|
{
|
||||||
++so;
|
++so;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataItem = dataMap.find( pout->GetUID() );
|
dataItem = dataMap.find( pout->GetUID() );
|
||||||
SCENEGRAPH* sg = NULL;
|
SCENEGRAPH* sg = nullptr;
|
||||||
|
|
||||||
if( dataItem == dataMap.end() )
|
if( dataItem == dataMap.end() )
|
||||||
{
|
{
|
||||||
sg = addOutline( pout, -1, NULL );
|
sg = addOutline( pout, -1, nullptr );
|
||||||
|
|
||||||
if( NULL == sg )
|
if( nullptr == sg )
|
||||||
{
|
{
|
||||||
++so;
|
++so;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
++ncomponents;
|
++ncomponents;
|
||||||
dataMap.insert( std::pair< std::string, SGNODE* >
|
dataMap.insert( std::pair< std::string, SGNODE* >( pout->GetUID(), (SGNODE*)sg ) );
|
||||||
( pout->GetUID(), (SGNODE*)sg ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -830,7 +859,7 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
IFSG_TRANSFORM txN( false );
|
IFSG_TRANSFORM txN( false );
|
||||||
txN.Attach( (SGNODE*)sg );
|
txN.Attach( (SGNODE*)sg );
|
||||||
|
|
||||||
if( NULL == txN.GetParent() )
|
if( nullptr == txN.GetParent() )
|
||||||
tx0.AddChildNode( txN );
|
tx0.AddChildNode( txN );
|
||||||
else
|
else
|
||||||
tx0.AddRefNode( txN );
|
tx0.AddRefNode( txN );
|
||||||
|
@ -869,7 +898,7 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
|
|
||||||
static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent )
|
static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
VRML_LAYER vpcb;
|
VRML_LAYER vpcb;
|
||||||
|
@ -922,7 +951,7 @@ static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent )
|
||||||
top = bot + pout->GetThickness();
|
top = bot + pout->GetThickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == vrmlToSG( vpcb, -1, aParent, top, bot ) )
|
if( nullptr == vrmlToSG( vpcb, -1, aParent, top, bot ) )
|
||||||
{
|
{
|
||||||
vpcb.Clear();
|
vpcb.Clear();
|
||||||
++sc;
|
++sc;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -96,13 +96,16 @@ typedef std::pair< std::string, std::vector< SGNODE* > > NODEITEM;
|
||||||
struct DATA;
|
struct DATA;
|
||||||
|
|
||||||
bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items );
|
std::vector< SGNODE* >* items );
|
||||||
|
|
||||||
|
|
||||||
bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items );
|
std::vector< SGNODE* >* items );
|
||||||
|
|
||||||
|
|
||||||
bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items, Quantity_Color* color );
|
std::vector< SGNODE* >* items, Quantity_Color* color );
|
||||||
|
|
||||||
|
|
||||||
struct DATA
|
struct DATA
|
||||||
{
|
{
|
||||||
|
@ -120,8 +123,8 @@ struct DATA
|
||||||
|
|
||||||
DATA()
|
DATA()
|
||||||
{
|
{
|
||||||
scene = NULL;
|
scene = nullptr;
|
||||||
defaultColor = NULL;
|
defaultColor = nullptr;
|
||||||
refColor.SetValues( Quantity_NOC_BLACK );
|
refColor.SetValues( Quantity_NOC_BLACK );
|
||||||
renderBoth = false;
|
renderBoth = false;
|
||||||
hasSolid = false;
|
hasSolid = false;
|
||||||
|
@ -137,7 +140,7 @@ struct DATA
|
||||||
|
|
||||||
while( sC != eC )
|
while( sC != eC )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( sC->second ) )
|
if( nullptr == S3D::GetSGNodeParent( sC->second ) )
|
||||||
S3D::DestroyNode( sC->second );
|
S3D::DestroyNode( sC->second );
|
||||||
|
|
||||||
++sC;
|
++sC;
|
||||||
|
@ -146,7 +149,7 @@ struct DATA
|
||||||
colors.clear();
|
colors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( defaultColor && NULL == S3D::GetSGNodeParent( defaultColor ) )
|
if( defaultColor && nullptr == S3D::GetSGNodeParent( defaultColor ) )
|
||||||
S3D::DestroyNode(defaultColor);
|
S3D::DestroyNode(defaultColor);
|
||||||
|
|
||||||
// destroy any faces with no parent
|
// destroy any faces with no parent
|
||||||
|
@ -157,7 +160,7 @@ struct DATA
|
||||||
|
|
||||||
while( sF != eF )
|
while( sF != eF )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( sF->second ) )
|
if( nullptr == S3D::GetSGNodeParent( sF->second ) )
|
||||||
S3D::DestroyNode( sF->second );
|
S3D::DestroyNode( sF->second );
|
||||||
|
|
||||||
++sF;
|
++sF;
|
||||||
|
@ -179,7 +182,7 @@ struct DATA
|
||||||
|
|
||||||
while( sV != eV )
|
while( sV != eV )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( *sV ) )
|
if( nullptr == S3D::GetSGNodeParent( *sV ) )
|
||||||
S3D::DestroyNode( *sV );
|
S3D::DestroyNode( *sV );
|
||||||
|
|
||||||
++sV;
|
++sV;
|
||||||
|
@ -194,14 +197,12 @@ struct DATA
|
||||||
|
|
||||||
if( scene )
|
if( scene )
|
||||||
S3D::DestroyNode(scene);
|
S3D::DestroyNode(scene);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find collection of tagged nodes
|
// find collection of tagged nodes
|
||||||
bool GetShape( const std::string& id, std::vector< SGNODE* >*& listPtr )
|
bool GetShape( const std::string& id, std::vector< SGNODE* >*& listPtr )
|
||||||
{
|
{
|
||||||
listPtr = NULL;
|
listPtr = nullptr;
|
||||||
NODEMAP::iterator item;
|
NODEMAP::iterator item;
|
||||||
item = shapes.find( id );
|
item = shapes.find( id );
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ struct DATA
|
||||||
item = faces.find( id );
|
item = faces.find( id );
|
||||||
|
|
||||||
if( item == faces.end() )
|
if( item == faces.end() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return item->second;
|
return item->second;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +228,7 @@ struct DATA
|
||||||
// return color if found; if not found, create SGAPPEARANCE
|
// return color if found; if not found, create SGAPPEARANCE
|
||||||
SGNODE* GetColor( Quantity_Color* colorObj )
|
SGNODE* GetColor( Quantity_Color* colorObj )
|
||||||
{
|
{
|
||||||
if( NULL == colorObj )
|
if( nullptr == colorObj )
|
||||||
{
|
{
|
||||||
if( defaultColor )
|
if( defaultColor )
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
|
@ -279,7 +280,7 @@ FormatType fileType( const char* aFileName )
|
||||||
return FMT_NONE;
|
return FMT_NONE;
|
||||||
|
|
||||||
if( fname.GetExt().MakeUpper().EndsWith( "STPZ" ) ||
|
if( fname.GetExt().MakeUpper().EndsWith( "STPZ" ) ||
|
||||||
fname.GetExt().MakeUpper().EndsWith( "GZ" ) )
|
fname.GetExt().MakeUpper().EndsWith( "GZ" ) )
|
||||||
return FMT_STPZ;
|
return FMT_STPZ;
|
||||||
|
|
||||||
char iline[82];
|
char iline[82];
|
||||||
|
@ -344,8 +345,6 @@ void getTag( TDF_Label& label, std::string& aTag )
|
||||||
aTag.append( 1, *bI );
|
aTag.append( 1, *bI );
|
||||||
++bI;
|
++bI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,7 +371,7 @@ bool getColor( DATA& data, TDF_Label label, Quantity_Color& color )
|
||||||
|
|
||||||
void addItems( SGNODE* parent, std::vector< SGNODE* >* lp )
|
void addItems( SGNODE* parent, std::vector< SGNODE* >* lp )
|
||||||
{
|
{
|
||||||
if( NULL == lp )
|
if( nullptr == lp )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector< SGNODE* >::iterator sL = lp->begin();
|
std::vector< SGNODE* >::iterator sL = lp->begin();
|
||||||
|
@ -383,19 +382,17 @@ void addItems( SGNODE* parent, std::vector< SGNODE* >* lp )
|
||||||
{
|
{
|
||||||
item = *sL;
|
item = *sL;
|
||||||
|
|
||||||
if( NULL == S3D::GetSGNodeParent( item ) )
|
if( nullptr == S3D::GetSGNodeParent( item ) )
|
||||||
S3D::AddSGNodeChild( parent, item );
|
S3D::AddSGNodeChild( parent, item );
|
||||||
else
|
else
|
||||||
S3D::AddSGNodeRef( parent, item );
|
S3D::AddSGNodeRef( parent, item );
|
||||||
|
|
||||||
++sL;
|
++sL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool readIGES( Handle(TDocStd_Document)& m_doc, const char* fname )
|
bool readIGES( Handle( TDocStd_Document ) & m_doc, const char* fname )
|
||||||
{
|
{
|
||||||
IGESCAFControl_Reader reader;
|
IGESCAFControl_Reader reader;
|
||||||
IFSelect_ReturnStatus stat = reader.ReadFile( fname );
|
IFSelect_ReturnStatus stat = reader.ReadFile( fname );
|
||||||
|
@ -441,9 +438,9 @@ bool readSTEP( Handle(TDocStd_Document)& m_doc, const char* fname )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// set other translation options
|
// set other translation options
|
||||||
reader.SetColorMode(true); // use model colors
|
reader.SetColorMode( true ); // use model colors
|
||||||
reader.SetNameMode(false); // don't use label names
|
reader.SetNameMode( false ); // don't use label names
|
||||||
reader.SetLayerMode(false); // ignore LAYER data
|
reader.SetLayerMode( false ); // ignore LAYER data
|
||||||
|
|
||||||
if ( !reader.Transfer( m_doc ) )
|
if ( !reader.Transfer( m_doc ) )
|
||||||
{
|
{
|
||||||
|
@ -539,27 +536,30 @@ SCENEGRAPH* LoadModel( char const* filename )
|
||||||
|
|
||||||
switch( modelFmt )
|
switch( modelFmt )
|
||||||
{
|
{
|
||||||
case FMT_IGES:
|
case FMT_IGES:
|
||||||
data.renderBoth = true;
|
data.renderBoth = true;
|
||||||
|
|
||||||
if( !readIGES( data.m_doc, filename ) )
|
if( !readIGES( data.m_doc, filename ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
break;
|
|
||||||
|
|
||||||
case FMT_STEP:
|
break;
|
||||||
if( !readSTEP( data.m_doc, filename ) )
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FMT_STPZ:
|
case FMT_STEP:
|
||||||
if( !readSTEPZ( data.m_doc, filename ) )
|
if( !readSTEP( data.m_doc, filename ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
break;
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FMT_STPZ:
|
||||||
|
if( !readSTEPZ( data.m_doc, filename ) )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.m_assy = XCAFDoc_DocumentTool::ShapeTool( data.m_doc->Main() );
|
data.m_assy = XCAFDoc_DocumentTool::ShapeTool( data.m_doc->Main() );
|
||||||
|
@ -579,21 +579,21 @@ SCENEGRAPH* LoadModel( char const* filename )
|
||||||
|
|
||||||
while( id <= nshapes )
|
while( id <= nshapes )
|
||||||
{
|
{
|
||||||
TopoDS_Shape shape = data.m_assy->GetShape( frshapes.Value(id) );
|
TopoDS_Shape shape = data.m_assy->GetShape( frshapes.Value( id ) );
|
||||||
|
|
||||||
if ( !shape.IsNull() && processNode( shape, data, data.scene, NULL ) )
|
if ( !shape.IsNull() && processNode( shape, data, data.scene, nullptr ) )
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
++id;
|
++id;
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !ret )
|
if( !ret )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
SCENEGRAPH* scene = (SCENEGRAPH*)data.scene;
|
SCENEGRAPH* scene = (SCENEGRAPH*)data.scene;
|
||||||
|
|
||||||
// DEBUG: WRITE OUT VRML2 FILE TO CONFIRM STRUCTURE
|
// DEBUG: WRITE OUT VRML2 FILE TO CONFIRM STRUCTURE
|
||||||
#if ( defined( DEBUG_OCE ) && DEBUG_OCE > 3 )
|
#if ( defined( DEBUG_OCE ) && DEBUG_OCE > 3 )
|
||||||
if( data.scene )
|
if( data.scene )
|
||||||
{
|
{
|
||||||
wxFileName fn( wxString::FromUTF8Unchecked( filename ) );
|
wxFileName fn( wxString::FromUTF8Unchecked( filename ) );
|
||||||
|
@ -605,20 +605,20 @@ SCENEGRAPH* LoadModel( char const* filename )
|
||||||
output = wxT( "_iges-" );
|
output = wxT( "_iges-" );
|
||||||
|
|
||||||
output.append( fn.GetName() );
|
output.append( fn.GetName() );
|
||||||
output.append( wxT(".wrl") );
|
output.append( wxT( ".wrl" ) );
|
||||||
S3D::WriteVRML( output.ToUTF8(), true, data.scene, true, true );
|
S3D::WriteVRML( output.ToUTF8(), true, data.scene, true, true );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set to NULL to prevent automatic destruction of the scene data
|
// set to NULL to prevent automatic destruction of the scene data
|
||||||
data.scene = NULL;
|
data.scene = nullptr;
|
||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool processShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
bool processShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items, Quantity_Color* color )
|
std::vector< SGNODE* >* items, Quantity_Color* color )
|
||||||
{
|
{
|
||||||
TopoDS_Iterator it;
|
TopoDS_Iterator it;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
@ -636,13 +636,13 @@ bool processShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
|
|
||||||
bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items )
|
std::vector< SGNODE* >* items )
|
||||||
{
|
{
|
||||||
TDF_Label label;
|
TDF_Label label;
|
||||||
data.hasSolid = true;
|
data.hasSolid = true;
|
||||||
std::string partID;
|
std::string partID;
|
||||||
Quantity_Color col;
|
Quantity_Color col;
|
||||||
Quantity_Color* lcolor = NULL;
|
Quantity_Color* lcolor = nullptr;
|
||||||
|
|
||||||
// Search the whole model first to make sure something exists (may or may not have color)
|
// Search the whole model first to make sure something exists (may or may not have color)
|
||||||
if( !data.m_assy->Search( shape, label ) )
|
if( !data.m_assy->Search( shape, label ) )
|
||||||
|
@ -666,7 +666,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
if( !found_color )
|
if( !found_color )
|
||||||
{
|
{
|
||||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_True, Standard_True ) &&
|
if( data.m_assy->Search( shape, label, Standard_False, Standard_True, Standard_True ) &&
|
||||||
getColor( data, label, col ) )
|
getColor( data, label, col ) )
|
||||||
{
|
{
|
||||||
found_color = true;
|
found_color = true;
|
||||||
lcolor = &col;
|
lcolor = &col;
|
||||||
|
@ -676,19 +676,22 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
// If the components do not have color information, search all components without location
|
// If the components do not have color information, search all components without location
|
||||||
if( !found_color )
|
if( !found_color )
|
||||||
{
|
{
|
||||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_False, Standard_True ) &&
|
if( data.m_assy->Search( shape, label, Standard_False, Standard_False,
|
||||||
getColor( data, label, col ) )
|
Standard_True ) &&
|
||||||
|
getColor( data, label, col ) )
|
||||||
{
|
{
|
||||||
found_color = true;
|
found_color = true;
|
||||||
lcolor = &col;
|
lcolor = &col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our last chance to find the color looks for color as a subshape of top-level simple shapes
|
// Our last chance to find the color looks for color as a subshape of top-level simple
|
||||||
|
// shapes.
|
||||||
if( !found_color )
|
if( !found_color )
|
||||||
{
|
{
|
||||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_False, Standard_False ) &&
|
if( data.m_assy->Search( shape, label, Standard_False, Standard_False,
|
||||||
getColor( data, label, col ) )
|
Standard_False ) &&
|
||||||
|
getColor( data, label, col ) )
|
||||||
{
|
{
|
||||||
found_color = true;
|
found_color = true;
|
||||||
lcolor = &col;
|
lcolor = &col;
|
||||||
|
@ -716,7 +719,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle );
|
childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< SGNODE* >* component = NULL;
|
std::vector< SGNODE* >* component = nullptr;
|
||||||
|
|
||||||
if( !partID.empty() )
|
if( !partID.empty() )
|
||||||
data.GetShape( partID, component );
|
data.GetShape( partID, component );
|
||||||
|
@ -725,7 +728,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
{
|
{
|
||||||
addItems( pptr, component );
|
addItems( pptr, component );
|
||||||
|
|
||||||
if( NULL != items )
|
if( nullptr != items )
|
||||||
items->push_back( pptr );
|
items->push_back( pptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,7 +745,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
if( !ret )
|
if( !ret )
|
||||||
childNode.Destroy();
|
childNode.Destroy();
|
||||||
else if( NULL != items )
|
else if( nullptr != items )
|
||||||
items->push_back( pptr );
|
items->push_back( pptr );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -750,7 +753,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
|
|
||||||
bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items )
|
std::vector< SGNODE* >* items )
|
||||||
{
|
{
|
||||||
TopoDS_Iterator it;
|
TopoDS_Iterator it;
|
||||||
IFSG_TRANSFORM childNode( parent );
|
IFSG_TRANSFORM childNode( parent );
|
||||||
|
@ -778,35 +781,39 @@ bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
switch( stype )
|
switch( stype )
|
||||||
{
|
{
|
||||||
case TopAbs_COMPOUND:
|
case TopAbs_COMPOUND:
|
||||||
case TopAbs_COMPSOLID:
|
case TopAbs_COMPSOLID:
|
||||||
if( processComp( subShape, data, pptr, items ) )
|
if( processComp( subShape, data, pptr, items ) )
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_SOLID:
|
break;
|
||||||
if( processSolid( subShape, data, pptr, items ) )
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_SHELL:
|
case TopAbs_SOLID:
|
||||||
if( processShell( subShape, data, pptr, items, NULL ) )
|
if( processSolid( subShape, data, pptr, items ) )
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_FACE:
|
break;
|
||||||
if( processFace( TopoDS::Face( subShape ), data, pptr, items, NULL ) )
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
case TopAbs_SHELL:
|
||||||
break;
|
if( processShell( subShape, data, pptr, items, nullptr ) )
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TopAbs_FACE:
|
||||||
|
if( processFace( TopoDS::Face( subShape ), data, pptr, items, nullptr ) )
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ret )
|
if( !ret )
|
||||||
childNode.Destroy();
|
childNode.Destroy();
|
||||||
else if( NULL != items )
|
else if( nullptr != items )
|
||||||
items->push_back( pptr );
|
items->push_back( pptr );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -822,29 +829,33 @@ bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
switch( stype )
|
switch( stype )
|
||||||
{
|
{
|
||||||
case TopAbs_COMPOUND:
|
case TopAbs_COMPOUND:
|
||||||
case TopAbs_COMPSOLID:
|
case TopAbs_COMPSOLID:
|
||||||
if( processComp( shape, data, parent, items ) )
|
if( processComp( shape, data, parent, items ) )
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_SOLID:
|
break;
|
||||||
if( processSolid( shape, data, parent, items ) )
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_SHELL:
|
case TopAbs_SOLID:
|
||||||
if( processShell( shape, data, parent, items, NULL ) )
|
if( processSolid( shape, data, parent, items ) )
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_FACE:
|
break;
|
||||||
if( processFace( TopoDS::Face( shape ), data, parent, items, NULL ) )
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
case TopAbs_SHELL:
|
||||||
break;
|
if( processShell( shape, data, parent, items, nullptr ) )
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TopAbs_FACE:
|
||||||
|
if( processFace( TopoDS::Face( shape ), data, parent, items, nullptr ) )
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -852,13 +863,13 @@ bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
|
|
||||||
bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
std::vector< SGNODE* >* items, Quantity_Color* color )
|
std::vector< SGNODE* >* items, Quantity_Color* color )
|
||||||
{
|
{
|
||||||
if( Standard_True == face.IsNull() )
|
if( Standard_True == face.IsNull() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool reverse = ( face.Orientation() == TopAbs_REVERSED );
|
bool reverse = ( face.Orientation() == TopAbs_REVERSED );
|
||||||
SGNODE* ashape = NULL;
|
SGNODE* ashape = nullptr;
|
||||||
std::string partID;
|
std::string partID;
|
||||||
TDF_Label label;
|
TDF_Label label;
|
||||||
|
|
||||||
|
@ -877,12 +888,12 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
if( ashape )
|
if( ashape )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( ashape ) )
|
if( nullptr == S3D::GetSGNodeParent( ashape ) )
|
||||||
S3D::AddSGNodeChild( parent, ashape );
|
S3D::AddSGNodeChild( parent, ashape );
|
||||||
else
|
else
|
||||||
S3D::AddSGNodeRef( parent, ashape );
|
S3D::AddSGNodeRef( parent, ashape );
|
||||||
|
|
||||||
if( NULL != items )
|
if( nullptr != items )
|
||||||
items->push_back( ashape );
|
items->push_back( ashape );
|
||||||
|
|
||||||
if( useBothSides )
|
if( useBothSides )
|
||||||
|
@ -891,12 +902,12 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
id2.append( "b" );
|
id2.append( "b" );
|
||||||
SGNODE* shapeB = data.GetFace( id2 );
|
SGNODE* shapeB = data.GetFace( id2 );
|
||||||
|
|
||||||
if( NULL == S3D::GetSGNodeParent( shapeB ) )
|
if( nullptr == S3D::GetSGNodeParent( shapeB ) )
|
||||||
S3D::AddSGNodeChild( parent, shapeB );
|
S3D::AddSGNodeChild( parent, shapeB );
|
||||||
else
|
else
|
||||||
S3D::AddSGNodeRef( parent, shapeB );
|
S3D::AddSGNodeRef( parent, shapeB );
|
||||||
|
|
||||||
if( NULL != items )
|
if( nullptr != items )
|
||||||
items->push_back( shapeB );
|
items->push_back( shapeB );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,12 +916,12 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
TopLoc_Location loc;
|
TopLoc_Location loc;
|
||||||
Standard_Boolean isTessellate (Standard_False);
|
Standard_Boolean isTessellate (Standard_False);
|
||||||
Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation( face, loc );
|
Handle( Poly_Triangulation ) triangulation = BRep_Tool::Triangulation( face, loc );
|
||||||
|
|
||||||
if( triangulation.IsNull() || triangulation->Deflection() > USER_PREC + Precision::Confusion() )
|
if( triangulation.IsNull() || triangulation->Deflection() > USER_PREC + Precision::Confusion() )
|
||||||
isTessellate = Standard_True;
|
isTessellate = Standard_True;
|
||||||
|
|
||||||
if (isTessellate)
|
if( isTessellate )
|
||||||
{
|
{
|
||||||
BRepMesh_IncrementalMesh IM(face, USER_PREC, Standard_False, USER_ANGLE );
|
BRepMesh_IncrementalMesh IM(face, USER_PREC, Standard_False, USER_ANGLE );
|
||||||
triangulation = BRep_Tool::Triangulation( face, loc );
|
triangulation = BRep_Tool::Triangulation( face, loc );
|
||||||
|
@ -944,7 +955,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
IFSG_COORDS vcoords( vface );
|
IFSG_COORDS vcoords( vface );
|
||||||
IFSG_COORDINDEX coordIdx( vface );
|
IFSG_COORDINDEX coordIdx( vface );
|
||||||
|
|
||||||
if( NULL == S3D::GetSGNodeParent( ocolor ) )
|
if( nullptr == S3D::GetSGNodeParent( ocolor ) )
|
||||||
S3D::AddSGNodeChild( vshape.GetRawPtr(), ocolor );
|
S3D::AddSGNodeChild( vshape.GetRawPtr(), ocolor );
|
||||||
else
|
else
|
||||||
S3D::AddSGNodeRef( vshape.GetRawPtr(), ocolor );
|
S3D::AddSGNodeRef( vshape.GetRawPtr(), ocolor );
|
||||||
|
@ -957,13 +968,13 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
std::vector< int > indices2;
|
std::vector< int > indices2;
|
||||||
gp_Trsf tx;
|
gp_Trsf tx;
|
||||||
|
|
||||||
for(int i = 1; i <= triangulation->NbNodes(); i++)
|
for( int i = 1; i <= triangulation->NbNodes(); i++ )
|
||||||
{
|
{
|
||||||
gp_XYZ v( arrPolyNodes(i).Coord() );
|
gp_XYZ v( arrPolyNodes(i).Coord() );
|
||||||
vertices.emplace_back( v.X(), v.Y(), v.Z() );
|
vertices.emplace_back( v.X(), v.Y(), v.Z() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 1; i <= triangulation->NbTriangles(); i++)
|
for( int i = 1; i <= triangulation->NbTriangles(); i++ )
|
||||||
{
|
{
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
arrTriangles( i ).Get( a, b, c );
|
arrTriangles( i ).Get( a, b, c );
|
||||||
|
@ -974,7 +985,9 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
int tmp = b - 1;
|
int tmp = b - 1;
|
||||||
b = c - 1;
|
b = c - 1;
|
||||||
c = tmp;
|
c = tmp;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
b--;
|
b--;
|
||||||
c--;
|
c--;
|
||||||
}
|
}
|
||||||
|
@ -993,12 +1006,11 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
vcoords.SetCoordsList( vertices.size(), &vertices[0] );
|
vcoords.SetCoordsList( vertices.size(), &vertices[0] );
|
||||||
coordIdx.SetIndices( indices.size(), &indices[0] );
|
coordIdx.SetIndices( indices.size(), &indices[0] );
|
||||||
vface.CalcNormals( NULL );
|
vface.CalcNormals( nullptr );
|
||||||
vshape.SetParent( parent );
|
vshape.SetParent( parent );
|
||||||
|
|
||||||
if( !partID.empty() )
|
if( !partID.empty() )
|
||||||
data.faces.insert( std::pair< std::string,
|
data.faces.insert( std::pair< std::string, SGNODE* >( partID, vshape.GetRawPtr() ) );
|
||||||
SGNODE* >( partID, vshape.GetRawPtr() ) );
|
|
||||||
|
|
||||||
// The outer surface of an IGES model is indeterminate so
|
// The outer surface of an IGES model is indeterminate so
|
||||||
// we must render both sides of a surface.
|
// we must render both sides of a surface.
|
||||||
|
@ -1014,12 +1026,11 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||||
|
|
||||||
vcoords2.SetCoordsList( vertices.size(), &vertices[0] );
|
vcoords2.SetCoordsList( vertices.size(), &vertices[0] );
|
||||||
coordIdx2.SetIndices( indices2.size(), &indices2[0] );
|
coordIdx2.SetIndices( indices2.size(), &indices2[0] );
|
||||||
vface2.CalcNormals( NULL );
|
vface2.CalcNormals( nullptr );
|
||||||
vshape2.SetParent( parent );
|
vshape2.SetParent( parent );
|
||||||
|
|
||||||
if( !partID.empty() )
|
if( !partID.empty() )
|
||||||
data.faces.insert( std::pair< std::string,
|
data.faces.insert( std::pair< std::string, SGNODE* >( id2, vshape2.GetRawPtr() ) );
|
||||||
SGNODE* >( id2, vshape2.GetRawPtr() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -23,8 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description:
|
* This plugin implements a STEP/IGES model renderer for KiCad via OCE
|
||||||
* This plugin implements a STEP/IGES model renderer for KiCad via OCE
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
@ -66,6 +65,7 @@ void GetPluginVersion( unsigned char* Major,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct FILE_DATA
|
static struct FILE_DATA
|
||||||
{
|
{
|
||||||
std::vector<std::string> extensions;
|
std::vector<std::string> extensions;
|
||||||
|
@ -75,13 +75,21 @@ static struct FILE_DATA
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
extensions = { "stp","step","stpz","stp.gz","step.gz","igs","iges" };
|
extensions = { "stp","step","stpz","stp.gz","step.gz","igs","iges" };
|
||||||
filters = { "STEP (*.stp;*.step;*.stpz;*.stp.gz;*.step.gz)|*.stp;*.step;*.stpz;*stp.gz;*.step.gz",
|
filters = {
|
||||||
"IGES (*.igs;*.iges)|*.igs;*.iges" };
|
"STEP (*.stp;*.step;*.stpz;*.stp.gz;*.step.gz)|*.stp;*.step;*.stpz;*stp.gz;*.step.gz",
|
||||||
|
"IGES (*.igs;*.iges)|*.igs;*.iges" };
|
||||||
#else
|
#else
|
||||||
extensions = { "stp","STP","stpZ","stpz","STPZ","step","STEP","stp.gz","STP.GZ","step.gz","STEP.GZ","igs","IGS","iges","IGES" };
|
extensions = {
|
||||||
filters = { "STEP (*.stp;*.STP;*.stpZ;*.stpz;*.STPZ;*.step;*.STEP;*.stp.gz;*.STP.GZ;*.step.gz;*.STEP.GZ)"
|
"stp","STP","stpZ","stpz","STPZ","step","STEP","stp.gz","STP.GZ","step.gz","STEP.GZ",
|
||||||
"|*.stp;*.STP;*.stpZ;*.stpz;*.STPZ;*.step;*.STEP;*.stp.gz;*.STP.GZ;*.step.gz;*.STEP.GZ",
|
"igs","IGS","iges","IGES"
|
||||||
"IGES (*.igs;*.IGS;*.iges;*.IGES)|*.igs;*.IGS;*.iges;*.IGES" };
|
};
|
||||||
|
|
||||||
|
filters = {
|
||||||
|
"STEP (*.stp;*.STP;*.stpZ;*.stpz;*.STPZ;*.step;*.STEP;*.stp.gz;*.STP.GZ;*.step.gz;"
|
||||||
|
"*.STEP.GZ)|*.stp;*.STP;*.stpZ;*.stpz;*.STPZ;*.step;*.STEP;*.stp.gz;*.STP.GZ;"
|
||||||
|
"*.step.gz;*.STEP.GZ",
|
||||||
|
"IGES (*.igs;*.IGS;*.iges;*.IGES)|*.igs;*.IGS;*.iges;*.IGES"
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +105,7 @@ int GetNExtensions( void )
|
||||||
char const* GetModelExtension( int aIndex )
|
char const* GetModelExtension( int aIndex )
|
||||||
{
|
{
|
||||||
if( aIndex < 0 || aIndex >= int( file_data.extensions.size() ) )
|
if( aIndex < 0 || aIndex >= int( file_data.extensions.size() ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return file_data.extensions[aIndex].c_str();
|
return file_data.extensions[aIndex].c_str();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +120,7 @@ int GetNFilters( void )
|
||||||
char const* GetFileFilter( int aIndex )
|
char const* GetFileFilter( int aIndex )
|
||||||
{
|
{
|
||||||
if( aIndex < 0 || aIndex >= int( file_data.filters.size() ) )
|
if( aIndex < 0 || aIndex >= int( file_data.filters.size() ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return file_data.filters[aIndex].c_str();
|
return file_data.filters[aIndex].c_str();
|
||||||
}
|
}
|
||||||
|
@ -127,13 +135,13 @@ bool CanRender( void )
|
||||||
|
|
||||||
SCENEGRAPH* Load( char const* aFileName )
|
SCENEGRAPH* Load( char const* aFileName )
|
||||||
{
|
{
|
||||||
if( NULL == aFileName )
|
if( nullptr == aFileName )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
||||||
|
|
||||||
if( !wxFileName::FileExists( fname ) )
|
if( !wxFileName::FileExists( fname ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return LoadModel( aFileName );
|
return LoadModel( aFileName );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
#include "plugins/3dapi/ifsg_all.h"
|
#include "plugins/3dapi/ifsg_all.h"
|
||||||
|
|
||||||
|
|
||||||
WRL1BASE::WRL1BASE() : WRL1NODE( NULL )
|
WRL1BASE::WRL1BASE() : WRL1NODE( nullptr )
|
||||||
{
|
{
|
||||||
m_Type = WRL1NODES::WRL1_BASE;
|
m_Type = WRL1NODES::WRL1_BASE;
|
||||||
m_dictionary = new NAMEREGISTER;
|
m_dictionary = new NAMEREGISTER;
|
||||||
|
@ -48,26 +49,22 @@ WRL1BASE::WRL1BASE() : WRL1NODE( NULL )
|
||||||
|
|
||||||
WRL1BASE::~WRL1BASE()
|
WRL1BASE::~WRL1BASE()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying virtual base node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying virtual base node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cancelDict();
|
cancelDict();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// functions inherited from WRL1NODE
|
|
||||||
bool WRL1BASE::SetParent( WRL1NODE* aParent, bool /* doUnlink */ )
|
bool WRL1BASE::SetParent( WRL1NODE* aParent, bool /* doUnlink */ )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to set parent on WRL1BASE node";
|
ostr << " * [BUG] attempting to set parent on WRL1BASE node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -75,14 +72,14 @@ bool WRL1BASE::SetParent( WRL1NODE* aParent, bool /* doUnlink */ )
|
||||||
|
|
||||||
std::string WRL1BASE::GetName( void )
|
std::string WRL1BASE::GetName( void )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to extract name from virtual base node";
|
ostr << " * [BUG] attempting to extract name from virtual base node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return std::string( "" );
|
return std::string( "" );
|
||||||
}
|
}
|
||||||
|
@ -90,14 +87,14 @@ std::string WRL1BASE::GetName( void )
|
||||||
|
|
||||||
bool WRL1BASE::SetName( const std::string& aName )
|
bool WRL1BASE::SetName( const std::string& aName )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to set name on virtual base node";
|
ostr << " * [BUG] attempting to set name on virtual base node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -107,14 +104,14 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
{
|
{
|
||||||
if( proc.GetVRMLType() != WRLVERSION::VRML_V1 )
|
if( proc.GetVRMLType() != WRLVERSION::VRML_V1 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] no open file or file is not a VRML1 file";
|
ostr << " * [BUG] no open file or file is not a VRML1 file";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -129,9 +126,9 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
size_t line, column;
|
size_t line, column;
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
if( !ReadNode( proc, this, NULL ) )
|
if( !ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -139,7 +136,7 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -147,14 +144,14 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
|
|
||||||
if( !proc.eof() )
|
if( !proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -165,19 +162,19 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
||||||
|
|
||||||
bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( !aParent )
|
if( !aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] invoked with NULL parent";
|
ostr << " * [BUG] invoked with NULL parent";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -186,14 +183,14 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -201,23 +198,23 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
WRL1NODE* ref = aParent->FindNode( glob );
|
WRL1NODE* ref = aParent->FindNode( glob );
|
||||||
|
|
||||||
// return 'true' - the file may be defective but it may still be somewhat OK
|
// return 'true' - the file may be defective but it may still be somewhat OK
|
||||||
if( NULL == ref )
|
if( nullptr == ref )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] node '" << glob << "' not found";
|
ostr << " * [INFO] node '" << glob << "' not found";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aParent->AddRefNode( ref ) )
|
if( !aParent->AddRefNode( ref ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -226,12 +223,12 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
|
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = ref;
|
*aNode = ref;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -240,36 +237,36 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
|
|
||||||
bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] invalid parent pointer (NULL)";
|
ostr << " * [BUG] invalid parent pointer (nullptr)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string glob;
|
std::string glob;
|
||||||
WRL1NODE* lnode = NULL;
|
WRL1NODE* lnode = nullptr;
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -279,12 +276,12 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
|
|
||||||
if( ReadNode( proc, aParent, &lnode ) )
|
if( ReadNode( proc, aParent, &lnode ) )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = lnode;
|
*aNode = lnode;
|
||||||
|
|
||||||
if( lnode && !lnode->SetName( glob ) )
|
if( lnode && !lnode->SetName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
size_t line, column;
|
size_t line, column;
|
||||||
|
@ -294,7 +291,7 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -319,19 +316,19 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
// must always check the value of aNode when the function returns
|
// must always check the value of aNode when the function returns
|
||||||
// 'true' since it will be NULL if the node type is not supported.
|
// 'true' since it will be NULL if the node type is not supported.
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] invalid parent pointer (NULL)";
|
ostr << " * [BUG] invalid parent pointer (NULL)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +338,7 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
if( !proc.eof() )
|
if( !proc.eof() )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -349,7 +346,7 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -362,14 +359,14 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !implementUse( proc, aParent, aNode ) )
|
if( !implementUse( proc, aParent, aNode ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -381,14 +378,14 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !implementDef( proc, aParent, aNode ) )
|
if( !implementDef( proc, aParent, aNode ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -401,13 +398,13 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
size_t column = 0;
|
size_t column = 0;
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
|
ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( ntype )
|
switch( ntype )
|
||||||
{
|
{
|
||||||
|
@ -486,7 +483,7 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
|
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -495,11 +492,11 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
ostr << ", column " << column;
|
ostr << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -507,7 +504,7 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
ostr << line << ", col " << column << " (currently unsupported)";
|
ostr << line << ", col " << column << " (currently unsupported)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +516,7 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
// this function makes no sense in the base node
|
// this function makes no sense in the base node
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -527,7 +524,7 @@ bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [BUG] this method must never be invoked on a WRL1BASE object";
|
ostr << " * [BUG] this method must never be invoked on a WRL1BASE object";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -535,8 +532,8 @@ bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1GROUP* np = new WRL1GROUP( m_dictionary, aParent );
|
WRL1GROUP* np = new WRL1GROUP( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -546,7 +543,7 @@ bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -555,8 +552,8 @@ bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
|
|
||||||
bool WRL1BASE::readSeparator( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readSeparator( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1SEPARATOR* np = new WRL1SEPARATOR( m_dictionary, aParent );
|
WRL1SEPARATOR* np = new WRL1SEPARATOR( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -566,7 +563,7 @@ bool WRL1BASE::readSeparator( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -583,7 +580,7 @@ bool WRL1BASE::readSwitch( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -592,8 +589,8 @@ bool WRL1BASE::readSwitch( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
|
|
||||||
bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1MATERIAL* np = new WRL1MATERIAL( m_dictionary, aParent );
|
WRL1MATERIAL* np = new WRL1MATERIAL( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -603,7 +600,7 @@ bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -612,8 +609,8 @@ bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
|
|
||||||
bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1MATBINDING* np = new WRL1MATBINDING( m_dictionary, aParent );
|
WRL1MATBINDING* np = new WRL1MATBINDING( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -623,7 +620,7 @@ bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -632,8 +629,8 @@ bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
||||||
|
|
||||||
bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1COORDS* np = new WRL1COORDS( m_dictionary, aParent );
|
WRL1COORDS* np = new WRL1COORDS( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -643,7 +640,7 @@ bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -652,8 +649,8 @@ bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
|
|
||||||
bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1FACESET* np = new WRL1FACESET( m_dictionary, aParent );
|
WRL1FACESET* np = new WRL1FACESET( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -663,7 +660,7 @@ bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -672,8 +669,8 @@ bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
|
|
||||||
bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1TRANSFORM* np = new WRL1TRANSFORM( m_dictionary, aParent );
|
WRL1TRANSFORM* np = new WRL1TRANSFORM( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -683,7 +680,7 @@ bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -692,8 +689,8 @@ bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
||||||
|
|
||||||
bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL1SHAPEHINTS* np = new WRL1SHAPEHINTS( m_dictionary, aParent );
|
WRL1SHAPEHINTS* np = new WRL1SHAPEHINTS( m_dictionary, aParent );
|
||||||
|
|
||||||
|
@ -703,7 +700,7 @@ bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL1NODE*) np;
|
*aNode = (WRL1NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -712,20 +709,20 @@ bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
||||||
|
|
||||||
SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating VRML1 Base with " << m_Items.size();
|
ostr << " * [INFO] Translating VRML1 Base with " << m_Items.size();
|
||||||
ostr << " items";
|
ostr << " items";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_Items.empty() )
|
if( m_Items.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( m_Items.size() == 1 )
|
if( m_Items.size() == 1 )
|
||||||
return (*m_Items.begin())->TranslateToSG( NULL, NULL );
|
return (*m_Items.begin())->TranslateToSG( nullptr, nullptr );
|
||||||
|
|
||||||
// Note: according to the VRML1 specification, a file may contain
|
// Note: according to the VRML1 specification, a file may contain
|
||||||
// only one grouping node at the top level. The following code
|
// only one grouping node at the top level. The following code
|
||||||
|
@ -743,7 +740,7 @@ SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
||||||
|
|
||||||
while( sI != eI )
|
while( sI != eI )
|
||||||
{
|
{
|
||||||
if( NULL != (*sI)->TranslateToSG( node, &m_current ) )
|
if( nullptr != (*sI)->TranslateToSG( node, &m_current ) )
|
||||||
hasContent = true;
|
hasContent = true;
|
||||||
|
|
||||||
++sI;
|
++sI;
|
||||||
|
@ -752,7 +749,7 @@ SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
||||||
if( !hasContent )
|
if( !hasContent )
|
||||||
{
|
{
|
||||||
txNode.Destroy();
|
txNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
m_Type = WRL1NODES::WRL1_COORDINATE3;
|
m_Type = WRL1NODES::WRL1_COORDINATE3;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,20 +43,16 @@ WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Type = WRL1NODES::WRL1_COORDINATE3;
|
m_Type = WRL1NODES::WRL1_COORDINATE3;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1COORDS::~WRL1COORDS()
|
WRL1COORDS::~WRL1COORDS()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate3 node\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate3 node\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,14 +60,14 @@ bool WRL1COORDS::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -81,14 +77,14 @@ bool WRL1COORDS::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +99,7 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -111,14 +107,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -127,7 +123,7 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column << "\n";
|
ostr << "' at line " << line << ", column " << column << "\n";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -143,14 +139,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +158,7 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( points ) )
|
if( !proc.ReadMFVec3f( points ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -172,14 +168,14 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError();
|
ostr << " * [INFO] message: '" << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -188,12 +184,12 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName();
|
ostr << " * [INFO] file: '" << proc.GetFileName();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assuming legacy kicad expectation of 1U = 0.1 inch,
|
// assuming legacy KiCad expectation of 1U = 0.1 inch,
|
||||||
// convert to mm to meet the expectations of the SG structure
|
// convert to mm to meet the expectations of the SG structure
|
||||||
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
||||||
std::vector< WRLVEC3F >::iterator eP = points.end();
|
std::vector< WRLVEC3F >::iterator eP = points.end();
|
||||||
|
@ -214,7 +210,7 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -223,7 +219,7 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName();
|
ostr << " * [INFO] file: '" << proc.GetFileName();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -233,29 +229,26 @@ void WRL1COORDS::GetCoords( WRLVEC3F*& aCoordList, size_t& aListSize )
|
||||||
{
|
{
|
||||||
if( points.size() < 3 )
|
if( points.size() < 3 )
|
||||||
{
|
{
|
||||||
aCoordList = NULL;
|
aCoordList = nullptr;
|
||||||
aListSize = 0;
|
aListSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aCoordList = &points[0];
|
aCoordList = &points[0];
|
||||||
aListSize = points.size();
|
aListSize = points.size();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SGNODE* WRL1COORDS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1COORDS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp->coord = this;
|
sp->coord = this;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,8 +38,6 @@
|
||||||
WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
|
m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,16 +47,14 @@ WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
|
m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1FACESET::~WRL1FACESET()
|
WRL1FACESET::~WRL1FACESET()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size();
|
ostr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size();
|
||||||
|
@ -65,9 +62,7 @@ WRL1FACESET::~WRL1FACESET()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,14 +70,14 @@ bool WRL1FACESET::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -92,14 +87,14 @@ bool WRL1FACESET::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +109,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -122,14 +117,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -138,7 +133,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -156,14 +151,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +173,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( coordIndex ) )
|
if( !proc.ReadMFInt( coordIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -188,7 +183,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError();
|
ostr << " * [INFO] message: '" << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +192,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( matIndex ) )
|
if( !proc.ReadMFInt( matIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -207,7 +202,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError();
|
ostr << " * [INFO] message: '" << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +211,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( normIndex ) )
|
if( !proc.ReadMFInt( normIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -226,7 +221,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError();
|
ostr << " * [INFO] message: '" << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +230,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( texIndex ) )
|
if( !proc.ReadMFInt( texIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -245,14 +240,14 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError();
|
ostr << " * [INFO] message: '" << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -261,7 +256,7 @@ bool WRL1FACESET::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -276,44 +271,40 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
// note: m_sgNode is unused because we cannot manage everything
|
// note: m_sgNode is unused because we cannot manage everything
|
||||||
// with a single reused transform due to the fact that VRML1
|
// with a single reused transform due to the fact that VRML1
|
||||||
// may use a MatrixTransformation entity which is impossible to
|
// may use a MatrixTransformation entity which is impossible to
|
||||||
// decompose into Rotate,Scale,Transform via an anlytic expression.
|
// decompose into Rotate,Scale,Transform via an analytic expression.
|
||||||
if( !m_Parent )
|
if( !m_Parent )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no parent node\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no parent node\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_current = *sp;
|
m_current = *sp;
|
||||||
|
|
||||||
if( NULL == m_current.coord || NULL == m_current.mat )
|
if( nullptr == m_current.coord || nullptr == m_current.mat )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
if( NULL == m_current.coord )
|
if( nullptr == m_current.coord )
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no vertex set\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no vertex set\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_current.mat )
|
if( nullptr == m_current.mat )
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no material set\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no material set\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRLVEC3F* pcoords;
|
WRLVEC3F* pcoords;
|
||||||
|
@ -324,20 +315,20 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
if( coordsize < 3 || vsize < 3 )
|
if( coordsize < 3 || vsize < 3 )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] bad model: coordsize, indexsize = " << coordsize;
|
ostr << " * [INFO] bad model: coordsize, indexsize = " << coordsize;
|
||||||
ostr << ", " << vsize;
|
ostr << ", " << vsize;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. create the vertex/normals/colors lists
|
// 1. create the vertex/normals/colors lists
|
||||||
SGNODE* sgcolor = NULL;
|
SGNODE* sgcolor = nullptr;
|
||||||
WRL1_BINDING mbind = m_current.matbind;
|
WRL1_BINDING mbind = m_current.matbind;
|
||||||
size_t matSize = matIndex.size();
|
size_t matSize = matIndex.size();
|
||||||
|
|
||||||
|
@ -352,9 +343,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
if( matIndex.empty() )
|
if( matIndex.empty() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: per face indexed but no indices\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: per face indexed but no indices\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
// support bad models by temporarily switching bindings
|
// support bad models by temporarily switching bindings
|
||||||
mbind = WRL1_BINDING::BIND_OVERALL;
|
mbind = WRL1_BINDING::BIND_OVERALL;
|
||||||
|
@ -373,7 +362,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
// copy the data into FACET structures
|
// copy the data into FACET structures
|
||||||
|
|
||||||
SHAPE lShape;
|
SHAPE lShape;
|
||||||
FACET* fp = NULL;
|
FACET* fp = nullptr;
|
||||||
size_t iCoord;
|
size_t iCoord;
|
||||||
int idx; // coordinate index
|
int idx; // coordinate index
|
||||||
size_t cidx = 0; // color index
|
size_t cidx = 0; // color index
|
||||||
|
@ -388,10 +377,10 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
if( idx < 0 )
|
if( idx < 0 )
|
||||||
{
|
{
|
||||||
if( NULL != fp )
|
if( nullptr != fp )
|
||||||
{
|
{
|
||||||
if( fp->HasMinPoints() )
|
if( fp->HasMinPoints() )
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
else
|
else
|
||||||
fp->Init();
|
fp->Init();
|
||||||
}
|
}
|
||||||
|
@ -403,7 +392,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
if( idx >= (int)coordsize )
|
if( idx >= (int)coordsize )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( NULL == fp )
|
if( nullptr == fp )
|
||||||
fp = lShape.NewFacet();
|
fp = lShape.NewFacet();
|
||||||
|
|
||||||
// push the vertex value and index
|
// push the vertex value and index
|
||||||
|
@ -425,10 +414,10 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
if( idx < 0 )
|
if( idx < 0 )
|
||||||
{
|
{
|
||||||
if( NULL != fp )
|
if( nullptr != fp )
|
||||||
{
|
{
|
||||||
if( fp->HasMinPoints() )
|
if( fp->HasMinPoints() )
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
else
|
else
|
||||||
fp->Init();
|
fp->Init();
|
||||||
}
|
}
|
||||||
|
@ -444,7 +433,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
if( idx >= (int)coordsize )
|
if( idx >= (int)coordsize )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( NULL == fp )
|
if( nullptr == fp )
|
||||||
fp = lShape.NewFacet();
|
fp = lShape.NewFacet();
|
||||||
|
|
||||||
// push the vertex value and index
|
// push the vertex value and index
|
||||||
|
@ -476,6 +465,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRL1_BINDING::BIND_PER_FACE_INDEXED:
|
case WRL1_BINDING::BIND_PER_FACE_INDEXED:
|
||||||
|
|
||||||
if( !fp->HasColors() )
|
if( !fp->HasColors() )
|
||||||
{
|
{
|
||||||
if( cidx >= matSize )
|
if( cidx >= matSize )
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -39,7 +40,6 @@
|
||||||
WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
m_Type = WRL1NODES::WRL1_GROUP;
|
m_Type = WRL1NODES::WRL1_GROUP;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,16 +49,14 @@ WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Type = WRL1NODES::WRL1_GROUP;
|
m_Type = WRL1NODES::WRL1_GROUP;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1GROUP::~WRL1GROUP()
|
WRL1GROUP::~WRL1GROUP()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Group with " << m_Children.size();
|
ostr << " * [INFO] Destroying Group with " << m_Children.size();
|
||||||
|
@ -66,25 +64,22 @@ WRL1GROUP::~WRL1GROUP()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// functions inherited from WRL1NODE
|
|
||||||
bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +91,7 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -104,14 +99,14 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -120,7 +115,7 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -137,9 +132,9 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -147,7 +142,7 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +158,7 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Group with " << m_Children.size();
|
ostr << " * [INFO] Translating Group with " << m_Children.size();
|
||||||
|
@ -172,34 +167,32 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
ostr << m_Items.size() << " items)";
|
ostr << m_Items.size() << " items)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !m_Parent )
|
if( !m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] Group has no parent";
|
ostr << " * [BUG] Group has no parent";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL1NODES::WRL1_BASE != m_Parent->GetNodeType() )
|
if( WRL1NODES::WRL1_BASE != m_Parent->GetNodeType() )
|
||||||
{
|
{
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( NULL == sp )
|
else if( nullptr == sp )
|
||||||
{
|
{
|
||||||
m_current.Init();
|
m_current.Init();
|
||||||
sp = &m_current;
|
sp = &m_current;
|
||||||
|
@ -207,9 +200,9 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -217,9 +210,9 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFSG_TRANSFORM txNode( aParent );
|
IFSG_TRANSFORM txNode( aParent );
|
||||||
|
@ -232,7 +225,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
while( sI != eI )
|
while( sI != eI )
|
||||||
{
|
{
|
||||||
if( NULL != (*sI)->TranslateToSG( node, sp ) )
|
if( nullptr != (*sI)->TranslateToSG( node, sp ) )
|
||||||
hasContent = true;
|
hasContent = true;
|
||||||
|
|
||||||
++sI;
|
++sI;
|
||||||
|
@ -241,7 +234,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
if( !hasContent )
|
if( !hasContent )
|
||||||
{
|
{
|
||||||
txNode.Destroy();
|
txNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -35,7 +36,6 @@ WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary ) : WRL1NODE( aDiction
|
||||||
{
|
{
|
||||||
m_binding = WRL1_BINDING::BIND_OVERALL;
|
m_binding = WRL1_BINDING::BIND_OVERALL;
|
||||||
m_Type = WRL1NODES::WRL1_MATERIALBINDING;
|
m_Type = WRL1NODES::WRL1_MATERIALBINDING;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,20 +46,14 @@ WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Type = WRL1NODES::WRL1_MATERIALBINDING;
|
m_Type = WRL1NODES::WRL1_MATERIALBINDING;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1MATBINDING::~WRL1MATBINDING()
|
WRL1MATBINDING::~WRL1MATBINDING()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying MaterialBinding node\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying MaterialBinding node\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,14 +61,14 @@ bool WRL1MATBINDING::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -84,14 +78,14 @@ bool WRL1MATBINDING::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -99,16 +93,16 @@ bool WRL1MATBINDING::AddChildNode( WRL1NODE* aNode )
|
||||||
|
|
||||||
bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +114,7 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -128,14 +122,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -144,7 +138,7 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -162,21 +156,21 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( glob.compare( "value" ) )
|
if( glob.compare( "value" ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -185,21 +179,21 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName();
|
ostr << " * [INFO] file: '" << proc.GetFileName();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +244,7 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -259,7 +253,7 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_binding = WRL1_BINDING::BIND_OVERALL;
|
m_binding = WRL1_BINDING::BIND_OVERALL;
|
||||||
}
|
}
|
||||||
|
@ -271,16 +265,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL1MATBINDING::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1MATBINDING::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp->matbind = m_binding;
|
sp->matbind = m_binding;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,61 +34,54 @@
|
||||||
|
|
||||||
WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
colors[0] = NULL;
|
colors[0] = nullptr;
|
||||||
colors[1] = NULL;
|
colors[1] = nullptr;
|
||||||
m_Type = WRL1NODES::WRL1_MATERIAL;
|
m_Type = WRL1NODES::WRL1_MATERIAL;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
WRL1NODE( aDictionary )
|
WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
colors[0] = NULL;
|
colors[0] = nullptr;
|
||||||
colors[1] = NULL;
|
colors[1] = nullptr;
|
||||||
m_Type = WRL1NODES::WRL1_MATERIAL;
|
m_Type = WRL1NODES::WRL1_MATERIAL;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1MATERIAL::~WRL1MATERIAL()
|
WRL1MATERIAL::~WRL1MATERIAL()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// destroy any orphaned color nodes
|
// destroy any orphaned color nodes
|
||||||
for( int i = 0; i < 2; ++i )
|
for( int i = 0; i < 2; ++i )
|
||||||
{
|
{
|
||||||
if( NULL != colors[i] )
|
if( nullptr != colors[i] )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying SGCOLOR #" << i;
|
ostr << " * [INFO] Destroying SGCOLOR #" << i;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( NULL == S3D::GetSGNodeParent( colors[i] ) )
|
if( nullptr == S3D::GetSGNodeParent( colors[i] ) )
|
||||||
S3D::DestroyNode( colors[i] );
|
S3D::DestroyNode( colors[i] );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] destroyed SGCOLOR #" << i;
|
ostr << " * [INFO] destroyed SGCOLOR #" << i;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,14 +89,14 @@ bool WRL1MATERIAL::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -112,14 +106,14 @@ bool WRL1MATERIAL::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -127,16 +121,16 @@ bool WRL1MATERIAL::AddChildNode( WRL1NODE* aNode )
|
||||||
|
|
||||||
bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is nullptr";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +142,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -156,14 +150,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -172,7 +166,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -190,14 +184,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +210,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( specularColor ) )
|
if( !proc.ReadMFVec3f( specularColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -226,7 +220,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +229,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( diffuseColor ) )
|
if( !proc.ReadMFVec3f( diffuseColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -245,7 +239,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -254,7 +248,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( emissiveColor ) )
|
if( !proc.ReadMFVec3f( emissiveColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -264,7 +258,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +267,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFFloat( shininess ) )
|
if( !proc.ReadMFFloat( shininess ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -283,7 +277,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +286,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFFloat( transparency ) )
|
if( !proc.ReadMFFloat( transparency ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -302,7 +296,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +305,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( ambientColor ) )
|
if( !proc.ReadMFVec3f( ambientColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -321,14 +315,14 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -337,7 +331,7 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -349,18 +343,16 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL1MATERIAL::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1MATERIAL::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp->mat = this;
|
sp->mat = this;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,7 +364,7 @@ SGNODE* WRL1MATERIAL::GetAppearance( int aIndex )
|
||||||
if( aIndex != 0 && aIndex != 1 )
|
if( aIndex != 0 && aIndex != 1 )
|
||||||
aIndex = 0;
|
aIndex = 0;
|
||||||
|
|
||||||
if( NULL != colors[ aIndex ] )
|
if( nullptr != colors[ aIndex ] )
|
||||||
return colors[ aIndex ];
|
return colors[ aIndex ];
|
||||||
|
|
||||||
IFSG_APPEARANCE app( true );
|
IFSG_APPEARANCE app( true );
|
||||||
|
@ -475,7 +467,7 @@ SGNODE* WRL1MATERIAL::GetAppearance( int aIndex )
|
||||||
|
|
||||||
void WRL1MATERIAL::GetColor( SGCOLOR* aColor, int aIndex )
|
void WRL1MATERIAL::GetColor( SGCOLOR* aColor, int aIndex )
|
||||||
{
|
{
|
||||||
if( NULL == aColor )
|
if( nullptr == aColor )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Calculate the color based on the given index using the formula:
|
// Calculate the color based on the given index using the formula:
|
||||||
|
@ -639,8 +631,6 @@ void WRL1MATERIAL::GetColor( SGCOLOR* aColor, int aIndex )
|
||||||
checkRange( green );
|
checkRange( green );
|
||||||
checkRange( blue );
|
checkRange( blue );
|
||||||
aColor->SetColor( red, green, blue );
|
aColor->SetColor( red, green, blue );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -650,32 +640,28 @@ void WRL1MATERIAL::checkRange( float& aValue )
|
||||||
aValue = 0.0;
|
aValue = 0.0;
|
||||||
else if( aValue > 1.0 )
|
else if( aValue > 1.0 )
|
||||||
aValue = 1.0;
|
aValue = 1.0;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL1MATERIAL::Reclaim( SGNODE* aColor )
|
void WRL1MATERIAL::Reclaim( SGNODE* aColor )
|
||||||
{
|
{
|
||||||
if( NULL == aColor )
|
if( nullptr == aColor )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aColor == colors[0] )
|
if( aColor == colors[0] )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( aColor ) )
|
if( nullptr == S3D::GetSGNodeParent( aColor ) )
|
||||||
{
|
{
|
||||||
colors[0] = NULL;
|
colors[0] = nullptr;
|
||||||
S3D::DestroyNode( aColor );
|
S3D::DestroyNode( aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aColor == colors[1] && NULL == S3D::GetSGNodeParent( aColor ) )
|
if( aColor == colors[1] && nullptr == S3D::GetSGNodeParent( aColor ) )
|
||||||
{
|
{
|
||||||
colors[1] = NULL;
|
colors[1] = nullptr;
|
||||||
S3D::DestroyNode( aColor );
|
S3D::DestroyNode( aColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -71,14 +72,14 @@ bool NAMEREGISTER::DelName( const std::string& aName, WRL1NODE* aNode )
|
||||||
WRL1NODE* NAMEREGISTER::FindName( const std::string& aName )
|
WRL1NODE* NAMEREGISTER::FindName( const std::string& aName )
|
||||||
{
|
{
|
||||||
if( aName.empty() )
|
if( aName.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
std::map< std::string, WRL1NODE* >::iterator ir = reg.find( aName );
|
std::map< std::string, WRL1NODE* >::iterator ir = reg.find( aName );
|
||||||
|
|
||||||
if( ir != reg.end() )
|
if( ir != reg.end() )
|
||||||
return ir->second;
|
return ir->second;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,14 +87,16 @@ typedef std::pair< std::string, WRL1NODES > NODEITEM;
|
||||||
typedef std::map< std::string, WRL1NODES > NODEMAP;
|
typedef std::map< std::string, WRL1NODES > NODEMAP;
|
||||||
static NODEMAP nodenames;
|
static NODEMAP nodenames;
|
||||||
|
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
std::string WRL1NODE::tabs = "";
|
std::string WRL1NODE::tabs = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary )
|
WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary )
|
||||||
{
|
{
|
||||||
m_sgNode = NULL;
|
m_sgNode = nullptr;
|
||||||
m_Parent = NULL;
|
m_Parent = nullptr;
|
||||||
m_Type = WRL1NODES::WRL1_END;
|
m_Type = WRL1NODES::WRL1_END;
|
||||||
m_dictionary = aDictionary;
|
m_dictionary = aDictionary;
|
||||||
|
|
||||||
|
@ -135,14 +138,12 @@ WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary )
|
||||||
nodenames.insert( NODEITEM( "WWWAnchor", WRL1NODES::WRL1_WWWANCHOR ) );
|
nodenames.insert( NODEITEM( "WWWAnchor", WRL1NODES::WRL1_WWWANCHOR ) );
|
||||||
nodenames.insert( NODEITEM( "WWWInline", WRL1NODES::WRL1_WWWINLINE ) );
|
nodenames.insert( NODEITEM( "WWWInline", WRL1NODES::WRL1_WWWINLINE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1NODE::~WRL1NODE()
|
WRL1NODE::~WRL1NODE()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] ^^ Destroying Type " << m_Type << " with " << m_Children.size();
|
ostr << " * [INFO] ^^ Destroying Type " << m_Type << " with " << m_Children.size();
|
||||||
|
@ -150,7 +151,7 @@ WRL1NODE::~WRL1NODE()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_Items.clear();
|
m_Items.clear();
|
||||||
|
|
||||||
|
@ -163,13 +164,13 @@ WRL1NODE::~WRL1NODE()
|
||||||
std::list< WRL1NODE* >::iterator sBP = m_BackPointers.begin();
|
std::list< WRL1NODE* >::iterator sBP = m_BackPointers.begin();
|
||||||
std::list< WRL1NODE* >::iterator eBP = m_BackPointers.end();
|
std::list< WRL1NODE* >::iterator eBP = m_BackPointers.end();
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
int acc = 0;
|
int acc = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while( sBP != eBP )
|
while( sBP != eBP )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
++acc;
|
++acc;
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -177,16 +178,16 @@ WRL1NODE::~WRL1NODE()
|
||||||
ostr << acc;
|
ostr << acc;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
(*sBP)->unlinkRefNode( this );
|
(*sBP)->unlinkRefNode( this );
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] " << tabs << "Type " << m_Type << " has unlinked ref #";
|
ostr << " * [INFO] " << tabs << "Type " << m_Type << " has unlinked ref #";
|
||||||
ostr << acc;
|
ostr << acc;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
++sBP;
|
++sBP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,49 +196,54 @@ WRL1NODE::~WRL1NODE()
|
||||||
std::list< WRL1NODE* >::iterator sC = m_Children.begin();
|
std::list< WRL1NODE* >::iterator sC = m_Children.begin();
|
||||||
std::list< WRL1NODE* >::iterator eC = m_Children.end();
|
std::list< WRL1NODE* >::iterator eC = m_Children.end();
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
std::string otabs = tabs;
|
std::string otabs = tabs;
|
||||||
tabs.append( " " );
|
tabs.append( " " );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while( sC != eC )
|
while( sC != eC )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
++acc;
|
++acc;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] " << otabs << "Type " << m_Type << " is Deleting child #";
|
ostr << " * [INFO] " << otabs << "Type " << m_Type << " is Deleting child #";
|
||||||
ostr << acc;
|
ostr << acc;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
(*sC)->SetParent( NULL, false );
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
(*sC)->SetParent( nullptr, false );
|
||||||
|
|
||||||
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] " << otabs << "Type " << m_Type << " has unlinked child #";
|
ostr << " * [INFO] " << otabs << "Type " << m_Type << " has unlinked child #";
|
||||||
ostr << acc;
|
ostr << acc;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete *sC;
|
delete *sC;
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
|
||||||
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] " << otabs << "Type " << m_Type << " has deleted child #";
|
ostr << " * [INFO] " << otabs << "Type " << m_Type << " has deleted child #";
|
||||||
ostr << acc;
|
ostr << acc;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
++sC;
|
++sC;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
tabs = otabs;
|
tabs = otabs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_Children.clear();
|
m_Children.clear();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,11 +258,10 @@ void WRL1NODE::cancelDict( void )
|
||||||
++sC;
|
++sC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_Type == WRL1NODES::WRL1_BASE && NULL != m_dictionary )
|
if( m_Type == WRL1NODES::WRL1_BASE && nullptr != m_dictionary )
|
||||||
delete m_dictionary;
|
delete m_dictionary;
|
||||||
|
|
||||||
m_dictionary = NULL;
|
m_dictionary = nullptr;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,8 +283,6 @@ void WRL1NODE::addNodeRef( WRL1NODE* aNode )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_BackPointers.push_back( aNode );
|
m_BackPointers.push_back( aNode );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,16 +297,14 @@ void WRL1NODE::delNodeRef( WRL1NODE* aNode )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] delNodeRef() did not find its target";
|
ostr << " * [BUG] delNodeRef() did not find its target";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,14 +333,14 @@ bool WRL1NODE::SetName( const std::string& aName )
|
||||||
|
|
||||||
if( isdigit( aName[0] ) )
|
if( isdigit( aName[0] ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] invalid node name '" << aName << "' (begins with digit)";
|
ostr << " * [INFO] invalid node name '" << aName << "' (begins with digit)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +354,7 @@ bool WRL1NODE::SetName( const std::string& aName )
|
||||||
if( std::string::npos != aName.find_first_of( BAD_CHARS1 )
|
if( std::string::npos != aName.find_first_of( BAD_CHARS1 )
|
||||||
|| std::string::npos != aName.find_first_of( BAD_CHARS2 ) )
|
|| std::string::npos != aName.find_first_of( BAD_CHARS2 ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -361,7 +362,7 @@ bool WRL1NODE::SetName( const std::string& aName )
|
||||||
ostr << "' (contains invalid character)";
|
ostr << "' (contains invalid character)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -415,8 +416,8 @@ std::string WRL1NODE::GetError( void )
|
||||||
|
|
||||||
WRL1NODE* WRL1NODE::FindNode( const std::string& aNodeName )
|
WRL1NODE* WRL1NODE::FindNode( const std::string& aNodeName )
|
||||||
{
|
{
|
||||||
if( NULL == m_dictionary )
|
if( nullptr == m_dictionary )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return m_dictionary->FindName( aNodeName );
|
return m_dictionary->FindName( aNodeName );
|
||||||
}
|
}
|
||||||
|
@ -427,12 +428,12 @@ bool WRL1NODE::SetParent( WRL1NODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -443,14 +444,14 @@ bool WRL1NODE::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
if( aNode->GetNodeType() == WRL1NODES::WRL1_BASE )
|
if( aNode->GetNodeType() == WRL1NODES::WRL1_BASE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to add a base node to another node";
|
ostr << " * [BUG] attempting to add a base node to another node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -478,30 +479,30 @@ bool WRL1NODE::AddChildNode( WRL1NODE* aNode )
|
||||||
|
|
||||||
bool WRL1NODE::AddRefNode( WRL1NODE* aNode )
|
bool WRL1NODE::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed as node pointer";
|
ostr << " * [BUG] NULL passed as node pointer";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aNode->GetNodeType() == WRL1NODES::WRL1_BASE )
|
if( aNode->GetNodeType() == WRL1NODES::WRL1_BASE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to add a base node ref to another base node";
|
ostr << " * [BUG] attempting to add a base node ref to another base node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -533,8 +534,6 @@ void WRL1NODE::unlinkChildNode( const WRL1NODE* aNode )
|
||||||
|
|
||||||
++sL;
|
++sL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -554,15 +553,12 @@ void WRL1NODE::unlinkRefNode( const WRL1NODE* aNode )
|
||||||
|
|
||||||
++sL;
|
++sL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL1NODE::addItem( WRL1NODE* aNode )
|
void WRL1NODE::addItem( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
m_Items.push_back( aNode );
|
m_Items.push_back( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -581,6 +577,4 @@ void WRL1NODE::delItem( const WRL1NODE* aNode )
|
||||||
|
|
||||||
++sL;
|
++sL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -67,16 +68,22 @@ struct WRL1STATUS
|
||||||
{
|
{
|
||||||
// material
|
// material
|
||||||
WRL1MATERIAL* mat;
|
WRL1MATERIAL* mat;
|
||||||
|
|
||||||
// normals
|
// normals
|
||||||
WRL1NODE* norm;
|
WRL1NODE* norm;
|
||||||
|
|
||||||
// coordinate3
|
// coordinate3
|
||||||
WRL1COORDS* coord;
|
WRL1COORDS* coord;
|
||||||
|
|
||||||
// material binding
|
// material binding
|
||||||
WRL1_BINDING matbind;
|
WRL1_BINDING matbind;
|
||||||
|
|
||||||
// normal binding
|
// normal binding
|
||||||
WRL1_BINDING normbind;
|
WRL1_BINDING normbind;
|
||||||
|
|
||||||
// transform
|
// transform
|
||||||
glm::mat4 txmatrix;
|
glm::mat4 txmatrix;
|
||||||
|
|
||||||
// winding order of vertices
|
// winding order of vertices
|
||||||
WRL1_ORDER order;
|
WRL1_ORDER order;
|
||||||
|
|
||||||
|
@ -91,11 +98,11 @@ struct WRL1STATUS
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
mat = NULL;
|
mat = nullptr;
|
||||||
matbind = WRL1_BINDING::BIND_OVERALL;
|
matbind = WRL1_BINDING::BIND_OVERALL;
|
||||||
norm = NULL;
|
norm = nullptr;
|
||||||
normbind = WRL1_BINDING::BIND_DEFAULT;
|
normbind = WRL1_BINDING::BIND_DEFAULT;
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
txmatrix = glm::scale( glm::mat4( 1.0 ), glm::vec3( 1.0 ) );
|
txmatrix = glm::scale( glm::mat4( 1.0 ), glm::vec3( 1.0 ) );
|
||||||
order = WRL1_ORDER::ORD_UNKNOWN;
|
order = WRL1_ORDER::ORD_UNKNOWN;
|
||||||
creaseLimit = 0.878f;
|
creaseLimit = 0.878f;
|
||||||
|
@ -105,11 +112,118 @@ struct WRL1STATUS
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WRL1NODE
|
* The base class of all VRML1 nodes
|
||||||
* represents the base class of all VRML1 nodes
|
|
||||||
*/
|
*/
|
||||||
class WRL1NODE
|
class WRL1NODE
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
|
static std::string tabs;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// cancel the dictionary pointer; for internal use only
|
||||||
|
void cancelDict( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ID based on the given \a aNodeName or WRL1_INVALID (WRL1_END)
|
||||||
|
* if no such node name exists.
|
||||||
|
*/
|
||||||
|
WRL1NODES getNodeTypeID( const std::string& aNodeName );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove references to an owned child; it is invoked by the child upon destruction
|
||||||
|
* to ensure that the parent has no invalid references.
|
||||||
|
*
|
||||||
|
* @param aNode is the child which is being deleted.
|
||||||
|
*/
|
||||||
|
virtual void unlinkChildNode( const WRL1NODE* aNode );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove pointers to a referenced node; it is invoked by the referenced node
|
||||||
|
* upon destruction to ensure that the referring node has no invalid references.
|
||||||
|
*
|
||||||
|
* @param aNode is the node which is being deleted.
|
||||||
|
*/
|
||||||
|
virtual void unlinkRefNode( const WRL1NODE* aNode );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a pointer to a node which references, but does not own, this node.
|
||||||
|
*
|
||||||
|
* Such back-pointers are required to ensure that invalidated references
|
||||||
|
* are removed when a node is deleted
|
||||||
|
*
|
||||||
|
* @param aNode is the node holding a reference to this object.
|
||||||
|
*/
|
||||||
|
void addNodeRef( WRL1NODE* aNode );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a pointer to a node which references, but does not own, this node.
|
||||||
|
*
|
||||||
|
* @param aNode is the node holding a reference to this object.
|
||||||
|
*/
|
||||||
|
void delNodeRef( WRL1NODE* aNode );
|
||||||
|
|
||||||
|
public:
|
||||||
|
WRL1NODE( NAMEREGISTER* aDictionary );
|
||||||
|
virtual ~WRL1NODE();
|
||||||
|
|
||||||
|
// read data via the given file processor and WRL1BASE object
|
||||||
|
virtual bool Read( WRLPROC& proc, WRL1BASE* aTopNode ) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the type of this node instance.
|
||||||
|
*/
|
||||||
|
WRL1NODES GetNodeType( void ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a pointer to the parent SGNODE of this object or NULL if the object has no
|
||||||
|
* parent (ie. top level transform).
|
||||||
|
*/
|
||||||
|
WRL1NODE* GetParent( void ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the parent WRL1NODE of this object.
|
||||||
|
*
|
||||||
|
* @param aParent [in] is the desired parent node.
|
||||||
|
* @param doUnlink indicates that the child must be unlinked from the parent
|
||||||
|
* @return true if the operation succeeds; false if the given node is not allowed to
|
||||||
|
* be a parent to the derived object.
|
||||||
|
*/
|
||||||
|
virtual bool SetParent( WRL1NODE* aParent, bool doUnlink = true );
|
||||||
|
|
||||||
|
virtual std::string GetName( void );
|
||||||
|
virtual bool SetName( const std::string& aName );
|
||||||
|
|
||||||
|
const char* GetNodeTypeName( WRL1NODES aNodeType ) const;
|
||||||
|
|
||||||
|
size_t GetNItems( void ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search the tree of linked nodes and returns a reference to the current node with the
|
||||||
|
* given name.
|
||||||
|
*
|
||||||
|
* The reference is then typically added to another node via AddRefNode().
|
||||||
|
*
|
||||||
|
* @param aNodeName is the name of the node to search for.
|
||||||
|
* @return is a valid node pointer on success, otherwise NULL.
|
||||||
|
*/
|
||||||
|
virtual WRL1NODE* FindNode( const std::string& aNodeName );
|
||||||
|
|
||||||
|
virtual bool AddChildNode( WRL1NODE* aNode );
|
||||||
|
|
||||||
|
virtual bool AddRefNode( WRL1NODE* aNode );
|
||||||
|
|
||||||
|
std::string GetError( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produce a representation of the data using the intermediate scenegraph structures of the
|
||||||
|
* kicad_3dsg library.
|
||||||
|
*
|
||||||
|
* @param aParent is a pointer to the parent SG node.
|
||||||
|
* @return is non-NULL on success.
|
||||||
|
*/
|
||||||
|
virtual SGNODE* TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addItem( WRL1NODE* aNode );
|
void addItem( WRL1NODE* aNode );
|
||||||
void delItem( const WRL1NODE* aNode );
|
void delItem( const WRL1NODE* aNode );
|
||||||
|
@ -136,122 +250,6 @@ protected:
|
||||||
// dictionary must be propagated to all children as well - perhaps
|
// dictionary must be propagated to all children as well - perhaps
|
||||||
// this is best done via a SetDictionary() function.
|
// this is best done via a SetDictionary() function.
|
||||||
NAMEREGISTER* m_dictionary;
|
NAMEREGISTER* m_dictionary;
|
||||||
|
|
||||||
public:
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
|
||||||
static std::string tabs;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// cancel the dictionary pointer; for internal use only
|
|
||||||
void cancelDict( void );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function getNodeTypeID
|
|
||||||
* returns the ID based on the given aNodeName or WRL1_INVALID (WRL1_END)
|
|
||||||
* if no such node name exists
|
|
||||||
*/
|
|
||||||
WRL1NODES getNodeTypeID( const std::string& aNodeName );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function unlinkChild
|
|
||||||
* removes references to an owned child; it is invoked by the child upon destruction
|
|
||||||
* to ensure that the parent has no invalid references.
|
|
||||||
*
|
|
||||||
* @param aNode is the child which is being deleted
|
|
||||||
*/
|
|
||||||
virtual void unlinkChildNode( const WRL1NODE* aNode );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function unlinkRef
|
|
||||||
* removes pointers to a referenced node; it is invoked by the referenced node
|
|
||||||
* upon destruction to ensure that the referring node has no invalid references.
|
|
||||||
*
|
|
||||||
* @param aNode is the node which is being deleted
|
|
||||||
*/
|
|
||||||
virtual void unlinkRefNode( const WRL1NODE* aNode );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function addNodeRef
|
|
||||||
* adds a pointer to a node which references, but does not own, this node.
|
|
||||||
* Such back-pointers are required to ensure that invalidated references
|
|
||||||
* are removed when a node is deleted
|
|
||||||
*
|
|
||||||
* @param aNode is the node holding a reference to this object
|
|
||||||
*/
|
|
||||||
void addNodeRef( WRL1NODE* aNode );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function delNodeRef
|
|
||||||
* removes a pointer to a node which references, but does not own, this node.
|
|
||||||
*
|
|
||||||
* @param aNode is the node holding a reference to this object
|
|
||||||
*/
|
|
||||||
void delNodeRef( WRL1NODE* aNode );
|
|
||||||
|
|
||||||
public:
|
|
||||||
WRL1NODE( NAMEREGISTER* aDictionary );
|
|
||||||
virtual ~WRL1NODE();
|
|
||||||
|
|
||||||
// read data via the given file processor and WRL1BASE object
|
|
||||||
virtual bool Read( WRLPROC& proc, WRL1BASE* aTopNode ) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetNodeType
|
|
||||||
* returns the type of this node instance
|
|
||||||
*/
|
|
||||||
WRL1NODES GetNodeType( void ) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetParent
|
|
||||||
* returns a pointer to the parent SGNODE of this object
|
|
||||||
* or NULL if the object has no parent (ie. top level transform)
|
|
||||||
*/
|
|
||||||
WRL1NODE* GetParent( void ) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetParent
|
|
||||||
* sets the parent WRL1NODE of this object.
|
|
||||||
*
|
|
||||||
* @param aParent [in] is the desired parent node
|
|
||||||
* @param doUnlink indicates that the child must be unlinked from the parent
|
|
||||||
* @return true if the operation succeeds; false if
|
|
||||||
* the given node is not allowed to be a parent to
|
|
||||||
* the derived object.
|
|
||||||
*/
|
|
||||||
virtual bool SetParent( WRL1NODE* aParent, bool doUnlink = true );
|
|
||||||
|
|
||||||
virtual std::string GetName( void );
|
|
||||||
virtual bool SetName( const std::string& aName );
|
|
||||||
|
|
||||||
const char* GetNodeTypeName( WRL1NODES aNodeType ) const;
|
|
||||||
|
|
||||||
size_t GetNItems( void ) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function FindNode searches the tree of linked nodes and returns a
|
|
||||||
* reference to the current node with the given name. The reference
|
|
||||||
* is then typically added to another node via AddRefNode().
|
|
||||||
*
|
|
||||||
* @param aNodeName is the name of the node to search for
|
|
||||||
* @return is a valid node pointer on success, otherwise NULL
|
|
||||||
*/
|
|
||||||
virtual WRL1NODE* FindNode( const std::string& aNodeName );
|
|
||||||
|
|
||||||
virtual bool AddChildNode( WRL1NODE* aNode );
|
|
||||||
|
|
||||||
virtual bool AddRefNode( WRL1NODE* aNode );
|
|
||||||
|
|
||||||
std::string GetError( void );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function TranslateToSG
|
|
||||||
* produces a representation of the data using the intermediate
|
|
||||||
* scenegraph structures of the kicad_3dsg library.
|
|
||||||
*
|
|
||||||
* @param aParent is a pointer to the parent SG node
|
|
||||||
* @return is non-NULL on success
|
|
||||||
*/
|
|
||||||
virtual SGNODE* TranslateToSG( SGNODE* aParent, WRL1STATUS* sp ) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VRML1_NODE_H
|
#endif // VRML1_NODE_H
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
m_Type = WRL1NODES::WRL1_SEPARATOR;
|
m_Type = WRL1NODES::WRL1_SEPARATOR;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,16 +43,14 @@ WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Type = WRL1NODES::WRL1_SEPARATOR;
|
m_Type = WRL1NODES::WRL1_SEPARATOR;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1SEPARATOR::~WRL1SEPARATOR()
|
WRL1SEPARATOR::~WRL1SEPARATOR()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Separator with " << m_Children.size();
|
ostr << " * [INFO] Destroying Separator with " << m_Children.size();
|
||||||
|
@ -60,25 +58,22 @@ WRL1SEPARATOR::~WRL1SEPARATOR()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// functions inherited from WRL1NODE
|
|
||||||
bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +85,7 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -98,14 +93,14 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -114,7 +109,7 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -131,9 +126,9 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -141,7 +136,7 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +152,7 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Separator with " << m_Children.size();
|
ostr << " * [INFO] Translating Separator with " << m_Children.size();
|
||||||
|
@ -166,32 +161,32 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
ostr << m_Items.size() << " items)";
|
ostr << m_Items.size() << " items)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !m_Parent )
|
if( !m_Parent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] Separator has no parent";
|
ostr << " * [BUG] Separator has no parent";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sp != NULL )
|
if( sp != nullptr )
|
||||||
m_current = *sp;
|
m_current = *sp;
|
||||||
else
|
else
|
||||||
m_current.Init();
|
m_current.Init();
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -199,9 +194,9 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
IFSG_TRANSFORM txNode( aParent );
|
IFSG_TRANSFORM txNode( aParent );
|
||||||
|
@ -214,7 +209,7 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
|
|
||||||
while( sI != eI )
|
while( sI != eI )
|
||||||
{
|
{
|
||||||
if( NULL != (*sI)->TranslateToSG( node, &m_current ) )
|
if( nullptr != (*sI)->TranslateToSG( node, &m_current ) )
|
||||||
hasContent = true;
|
hasContent = true;
|
||||||
|
|
||||||
++sI;
|
++sI;
|
||||||
|
@ -223,7 +218,7 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
if( !hasContent )
|
if( !hasContent )
|
||||||
{
|
{
|
||||||
txNode.Destroy();
|
txNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,7 +38,6 @@ WRL1SHAPEHINTS::WRL1SHAPEHINTS( NAMEREGISTER* aDictionary ) : WRL1NODE( aDiction
|
||||||
m_order = WRL1_ORDER::ORD_UNKNOWN;
|
m_order = WRL1_ORDER::ORD_UNKNOWN;
|
||||||
m_Type = WRL1NODES::WRL1_SHAPEHINTS;
|
m_Type = WRL1NODES::WRL1_SHAPEHINTS;
|
||||||
m_crease = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
m_crease = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,20 +49,14 @@ WRL1SHAPEHINTS::WRL1SHAPEHINTS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_crease = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
m_crease = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1SHAPEHINTS::~WRL1SHAPEHINTS()
|
WRL1SHAPEHINTS::~WRL1SHAPEHINTS()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying ShapeHints node\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying ShapeHints node\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,14 +64,14 @@ bool WRL1SHAPEHINTS::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -87,14 +81,14 @@ bool WRL1SHAPEHINTS::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,16 +96,16 @@ bool WRL1SHAPEHINTS::AddChildNode( WRL1NODE* aNode )
|
||||||
|
|
||||||
bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +117,7 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -131,14 +125,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -147,7 +141,7 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -165,14 +159,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -187,14 +181,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +201,7 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
m_order = WRL1_ORDER::ORD_CCW;
|
m_order = WRL1_ORDER::ORD_CCW;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -216,7 +210,7 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -225,14 +219,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -245,14 +239,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -267,14 +261,14 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadSFFloat( tmp ) )
|
if( !proc.ReadSFFloat( tmp ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +282,7 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -297,7 +291,7 @@ bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -312,13 +306,11 @@ SGNODE* WRL1SHAPEHINTS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
// note: this is not fully implemented since it is unlikely we shall
|
// note: this is not fully implemented since it is unlikely we shall
|
||||||
// ever make use of the fields shapeType, faceType, and creaseAngle
|
// ever make use of the fields shapeType, faceType, and creaseAngle
|
||||||
|
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sp->order = m_order;
|
sp->order = m_order;
|
||||||
|
@ -327,5 +319,5 @@ SGNODE* WRL1SHAPEHINTS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
if( sp->creaseLimit < 0.0 )
|
if( sp->creaseLimit < 0.0 )
|
||||||
sp->creaseLimit = 0.0;
|
sp->creaseLimit = 0.0;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -35,8 +36,6 @@ WRL1SWITCH::WRL1SWITCH( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||||
{
|
{
|
||||||
m_Type = WRL1NODES::WRL1_SWITCH;
|
m_Type = WRL1NODES::WRL1_SWITCH;
|
||||||
whichChild = -1;
|
whichChild = -1;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,16 +46,14 @@ WRL1SWITCH::WRL1SWITCH( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
whichChild = -1;
|
whichChild = -1;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL1SWITCH::~WRL1SWITCH()
|
WRL1SWITCH::~WRL1SWITCH()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Switch with " << m_Children.size();
|
ostr << " * [INFO] Destroying Switch with " << m_Children.size();
|
||||||
|
@ -64,13 +61,10 @@ WRL1SWITCH::~WRL1SWITCH()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// functions inherited from WRL1NODE
|
|
||||||
bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -82,16 +76,16 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +97,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -111,14 +105,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -127,7 +121,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -148,14 +142,14 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +158,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFInt( whichChild ) )
|
if( !proc.ReadSFInt( whichChild ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -174,7 +168,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +176,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -191,16 +185,16 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -208,7 +202,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +218,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Switch with " << m_Children.size();
|
ostr << " * [INFO] Translating Switch with " << m_Children.size();
|
||||||
|
@ -233,15 +227,15 @@ SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
ostr << m_Items.size() << " items)";
|
ostr << m_Items.size() << " items)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_Items.empty() )
|
if( m_Items.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( whichChild < 0 || whichChild >= (int)m_Items.size() )
|
if( whichChild < 0 || whichChild >= (int)m_Items.size() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( sp == NULL )
|
if( sp == nullptr )
|
||||||
{
|
{
|
||||||
m_current.Init();
|
m_current.Init();
|
||||||
sp = &m_current;
|
sp = &m_current;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -43,7 +44,7 @@ WRL1TRANSFORM::WRL1TRANSFORM( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
m_Type = WRL1NODES::WRL1_TRANSFORM;
|
m_Type = WRL1NODES::WRL1_TRANSFORM;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -52,7 +53,7 @@ WRL1TRANSFORM::WRL1TRANSFORM( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||||
|
|
||||||
WRL1TRANSFORM::~WRL1TRANSFORM()
|
WRL1TRANSFORM::~WRL1TRANSFORM()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Transform with " << m_Children.size();
|
ostr << " * [INFO] Destroying Transform with " << m_Children.size();
|
||||||
|
@ -60,9 +61,7 @@ WRL1TRANSFORM::~WRL1TRANSFORM()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,16 +79,16 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +117,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -126,14 +125,14 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -142,7 +141,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -160,14 +159,14 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +184,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( center ) )
|
if( !proc.ReadSFVec3f( center ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -195,7 +194,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +208,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFRotation( rotation ) )
|
if( !proc.ReadSFRotation( rotation ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -219,7 +218,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( scale ) )
|
if( !proc.ReadSFVec3f( scale ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -238,7 +237,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +246,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFRotation( scaleOrientation ) )
|
if( !proc.ReadSFRotation( scaleOrientation ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -257,7 +256,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +265,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( translation ) )
|
if( !proc.ReadSFVec3f( translation ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -276,7 +275,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +287,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -297,7 +296,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -311,14 +310,14 @@ bool WRL1TRANSFORM::AddRefNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -328,14 +327,14 @@ bool WRL1TRANSFORM::AddChildNode( WRL1NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML1
|
#ifdef DEBUG_VRML1
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -343,19 +342,17 @@ bool WRL1TRANSFORM::AddChildNode( WRL1NODE* aNode )
|
||||||
|
|
||||||
SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
{
|
{
|
||||||
if( NULL == m_Parent )
|
if( nullptr == m_Parent )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( WRL1NODES::WRL1_BASE == m_Parent->GetNodeType() )
|
if( WRL1NODES::WRL1_BASE == m_Parent->GetNodeType() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotation
|
// rotation
|
||||||
|
@ -365,20 +362,24 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
rZ = rotation.z;
|
rZ = rotation.z;
|
||||||
rW = rotation.w;
|
rW = rotation.w;
|
||||||
glm::mat4 rM = glm::rotate( glm::mat4( 1.0f ), rW, glm::vec3( rX, rY, rZ ) );
|
glm::mat4 rM = glm::rotate( glm::mat4( 1.0f ), rW, glm::vec3( rX, rY, rZ ) );
|
||||||
|
|
||||||
// translation
|
// translation
|
||||||
float dX, dY, dZ;
|
float dX, dY, dZ;
|
||||||
dX = translation.x;
|
dX = translation.x;
|
||||||
dY = translation.y;
|
dY = translation.y;
|
||||||
dZ = translation.z;
|
dZ = translation.z;
|
||||||
glm::mat4 tM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
|
glm::mat4 tM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
|
||||||
|
|
||||||
// center
|
// center
|
||||||
dX = center.x;
|
dX = center.x;
|
||||||
dY = center.y;
|
dY = center.y;
|
||||||
dZ = center.z;
|
dZ = center.z;
|
||||||
glm::mat4 cM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
|
glm::mat4 cM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
|
||||||
glm::mat4 ncM = glm::translate( glm::mat4( 1.0f ), glm::vec3( -dX, -dY, -dZ ) );
|
glm::mat4 ncM = glm::translate( glm::mat4( 1.0f ), glm::vec3( -dX, -dY, -dZ ) );
|
||||||
|
|
||||||
// scale
|
// scale
|
||||||
glm::mat4 sM = glm::scale( glm::mat4( 1.0 ), glm::vec3( scale.x, scale.y, scale.z ) );
|
glm::mat4 sM = glm::scale( glm::mat4( 1.0 ), glm::vec3( scale.x, scale.y, scale.z ) );
|
||||||
|
|
||||||
// scaleOrientation
|
// scaleOrientation
|
||||||
rX = scaleOrientation.x;
|
rX = scaleOrientation.x;
|
||||||
rY = scaleOrientation.y;
|
rY = scaleOrientation.y;
|
||||||
|
@ -391,5 +392,5 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||||
// tx' = tM * cM * rM * srM * sM * nsrM * ncM
|
// tx' = tM * cM * rM * srM * sM * nsrM * ncM
|
||||||
sp->txmatrix = sp->txmatrix * tM * cM * rM * srM * sM * nsrM * ncM;
|
sp->txmatrix = sp->txmatrix * tM * cM * rM * srM * sM * nsrM * ncM;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,32 +34,29 @@
|
||||||
|
|
||||||
WRL2APPEARANCE::WRL2APPEARANCE() : WRL2NODE()
|
WRL2APPEARANCE::WRL2APPEARANCE() : WRL2NODE()
|
||||||
{
|
{
|
||||||
material = NULL;
|
material = nullptr;
|
||||||
texture = NULL;
|
texture = nullptr;
|
||||||
textureTransform = NULL;
|
textureTransform = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_APPEARANCE;
|
m_Type = WRL2NODES::WRL2_APPEARANCE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2APPEARANCE::WRL2APPEARANCE( WRL2NODE* aParent ) : WRL2NODE()
|
WRL2APPEARANCE::WRL2APPEARANCE( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
{
|
{
|
||||||
material = NULL;
|
material = nullptr;
|
||||||
texture = NULL;
|
texture = nullptr;
|
||||||
textureTransform = NULL;
|
textureTransform = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_APPEARANCE;
|
m_Type = WRL2NODES::WRL2_APPEARANCE;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2APPEARANCE::~WRL2APPEARANCE()
|
WRL2APPEARANCE::~WRL2APPEARANCE()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Appearance with " << m_Children.size();
|
ostr << " * [INFO] Destroying Appearance with " << m_Children.size();
|
||||||
|
@ -66,7 +64,7 @@ WRL2APPEARANCE::~WRL2APPEARANCE()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +92,7 @@ bool WRL2APPEARANCE::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -103,16 +101,16 @@ bool WRL2APPEARANCE::isDangling( void )
|
||||||
|
|
||||||
bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +119,7 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -129,23 +127,23 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_MATERIAL == type )
|
if( WRL2NODES::WRL2_MATERIAL == type )
|
||||||
{
|
{
|
||||||
if( NULL != material )
|
if( nullptr != material )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple material nodes";
|
ostr << " * [INFO] bad file format; multiple material nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -156,16 +154,16 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_TEXTURETRANSFORM == type )
|
if( WRL2NODES::WRL2_TEXTURETRANSFORM == type )
|
||||||
{
|
{
|
||||||
if( NULL != textureTransform )
|
if( nullptr != textureTransform )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple textureTransform nodes";
|
ostr << " * [INFO] bad file format; multiple textureTransform nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -174,16 +172,16 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||||
return WRL2NODE::AddRefNode( aNode );
|
return WRL2NODE::AddRefNode( aNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != texture )
|
if( nullptr != texture )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple texture nodes";
|
ostr << " * [INFO] bad file format; multiple texture nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -195,16 +193,16 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +211,7 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -221,23 +219,23 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_MATERIAL == type )
|
if( WRL2NODES::WRL2_MATERIAL == type )
|
||||||
{
|
{
|
||||||
if( NULL != material )
|
if( nullptr != material )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple material nodes";
|
ostr << " * [INFO] bad file format; multiple material nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -248,16 +246,16 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_TEXTURETRANSFORM == type )
|
if( WRL2NODES::WRL2_TEXTURETRANSFORM == type )
|
||||||
{
|
{
|
||||||
if( NULL != textureTransform )
|
if( nullptr != textureTransform )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple textureTransform nodes";
|
ostr << " * [INFO] bad file format; multiple textureTransform nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -266,16 +264,16 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||||
return WRL2NODE::AddChildNode( aNode );
|
return WRL2NODE::AddChildNode( aNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != texture )
|
if( nullptr != texture )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple texture nodes";
|
ostr << " * [INFO] bad file format; multiple texture nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -287,16 +285,16 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +306,7 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -316,14 +314,14 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -332,7 +330,7 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -350,14 +348,14 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -371,55 +369,55 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !glob.compare( "material" ) )
|
if( !glob.compare( "material" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read material information";
|
ostr << " * [INFO] could not read material information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "texture" ) )
|
else if( !glob.compare( "texture" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read texture information";
|
ostr << " * [INFO] could not read texture information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "textureTransform" ) )
|
else if( !glob.compare( "textureTransform" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read textureTransform information";
|
ostr << " * [INFO] could not read textureTransform information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -428,7 +426,7 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -440,14 +438,14 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == material && NULL == texture )
|
if( nullptr == material && nullptr == texture )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -455,12 +453,12 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Appearance with " << m_Children.size();
|
ostr << " * [INFO] Translating Appearance with " << m_Children.size();
|
||||||
|
@ -468,28 +466,28 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_sgNode;
|
return m_sgNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != texture )
|
if( nullptr != texture )
|
||||||
{
|
{
|
||||||
// use a default gray appearance
|
// use a default gray appearance
|
||||||
IFSG_APPEARANCE matNode( aParent );
|
IFSG_APPEARANCE matNode( aParent );
|
||||||
|
@ -512,41 +510,38 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
void WRL2APPEARANCE::unlinkChildNode( const WRL2NODE* aNode )
|
void WRL2APPEARANCE::unlinkChildNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() == this )
|
if( aNode->GetParent() == this )
|
||||||
{
|
{
|
||||||
if( aNode == material )
|
if( aNode == material )
|
||||||
material = NULL;
|
material = nullptr;
|
||||||
else if( aNode == texture )
|
else if( aNode == texture )
|
||||||
texture = NULL;
|
texture = nullptr;
|
||||||
else if( aNode == textureTransform )
|
else if( aNode == textureTransform )
|
||||||
textureTransform = NULL;
|
textureTransform = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkChildNode( aNode );
|
WRL2NODE::unlinkChildNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2APPEARANCE::unlinkRefNode( const WRL2NODE* aNode )
|
void WRL2APPEARANCE::unlinkRefNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() != this )
|
if( aNode->GetParent() != this )
|
||||||
{
|
{
|
||||||
if( aNode == material )
|
if( aNode == material )
|
||||||
material = NULL;
|
material = nullptr;
|
||||||
else if( aNode == texture )
|
else if( aNode == texture )
|
||||||
texture = NULL;
|
texture = nullptr;
|
||||||
else if( aNode == textureTransform )
|
else if( aNode == textureTransform )
|
||||||
textureTransform = NULL;
|
textureTransform = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkRefNode( aNode );
|
WRL2NODE::unlinkRefNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -47,11 +48,11 @@
|
||||||
|
|
||||||
SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline );
|
SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline );
|
||||||
|
|
||||||
|
|
||||||
WRL2BASE::WRL2BASE() : WRL2NODE()
|
WRL2BASE::WRL2BASE() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_useInline = false;
|
m_useInline = false;
|
||||||
m_Type = WRL2NODES::WRL2_BASE;
|
m_Type = WRL2NODES::WRL2_BASE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,29 +66,26 @@ WRL2BASE::~WRL2BASE()
|
||||||
SGNODE* np = iS->second;
|
SGNODE* np = iS->second;
|
||||||
|
|
||||||
// destroy any orphaned Inline{} node data
|
// destroy any orphaned Inline{} node data
|
||||||
if( np && NULL == S3D::GetSGNodeParent( np ) )
|
if( np && nullptr == S3D::GetSGNodeParent( np ) )
|
||||||
S3D::DestroyNode( np );
|
S3D::DestroyNode( np );
|
||||||
|
|
||||||
++iS;
|
++iS;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inlineModels.clear();
|
m_inlineModels.clear();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// functions inherited from WRL2NODE
|
|
||||||
bool WRL2BASE::SetParent( WRL2NODE* aParent, bool /* doUnlink */ )
|
bool WRL2BASE::SetParent( WRL2NODE* aParent, bool /* doUnlink */ )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to set parent on WRL2BASE node";
|
ostr << " * [BUG] attempting to set parent on WRL2BASE node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +94,6 @@ bool WRL2BASE::SetParent( WRL2NODE* aParent, bool /* doUnlink */ )
|
||||||
void WRL2BASE::SetEnableInline( bool enable )
|
void WRL2BASE::SetEnableInline( bool enable )
|
||||||
{
|
{
|
||||||
m_useInline = enable;
|
m_useInline = enable;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +106,7 @@ bool WRL2BASE::GetEnableInline( void )
|
||||||
SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
||||||
{
|
{
|
||||||
if( aName.empty() )
|
if( aName.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
std::map< std::string, SGNODE* >::iterator dp = m_inlineModels.find( aName );
|
std::map< std::string, SGNODE* >::iterator dp = m_inlineModels.find( aName );
|
||||||
|
|
||||||
|
@ -121,7 +118,7 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
||||||
if( aName.compare( 0, 7, "file://" ) == 0 )
|
if( aName.compare( 0, 7, "file://" ) == 0 )
|
||||||
{
|
{
|
||||||
if( aName.length() <= 7 )
|
if( aName.length() <= 7 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
|
tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
|
||||||
}
|
}
|
||||||
|
@ -142,16 +139,16 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
||||||
|
|
||||||
if( !fn.Normalize() )
|
if( !fn.Normalize() )
|
||||||
{
|
{
|
||||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
|
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, nullptr ) );
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENEGRAPH* sp = LoadVRML( fn.GetFullPath(), false );
|
SCENEGRAPH* sp = LoadVRML( fn.GetFullPath(), false );
|
||||||
|
|
||||||
if( NULL == sp )
|
if( nullptr == sp )
|
||||||
{
|
{
|
||||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
|
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, nullptr ) );
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, (SGNODE*)sp ) );
|
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, (SGNODE*)sp ) );
|
||||||
|
@ -162,14 +159,14 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
||||||
|
|
||||||
std::string WRL2BASE::GetName( void )
|
std::string WRL2BASE::GetName( void )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to extract name from virtual base node";
|
ostr << " * [BUG] attempting to extract name from virtual base node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return std::string( "" );
|
return std::string( "" );
|
||||||
}
|
}
|
||||||
|
@ -177,14 +174,14 @@ std::string WRL2BASE::GetName( void )
|
||||||
|
|
||||||
bool WRL2BASE::SetName( const std::string& aName )
|
bool WRL2BASE::SetName( const std::string& aName )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to set name on virtual base node";
|
ostr << " * [BUG] attempting to set name on virtual base node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -194,19 +191,19 @@ bool WRL2BASE::Read( WRLPROC& proc )
|
||||||
{
|
{
|
||||||
if( proc.GetVRMLType() != WRLVERSION::VRML_V2 )
|
if( proc.GetVRMLType() != WRLVERSION::VRML_V2 )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] no open file or file is not a VRML2 file";
|
ostr << " * [BUG] no open file or file is not a VRML2 file";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE* node = NULL;
|
WRL2NODE* node = nullptr;
|
||||||
m_dir = proc.GetParentDir();
|
m_dir = proc.GetParentDir();
|
||||||
|
|
||||||
while( ReadNode( proc, this, &node ) && !proc.eof() );
|
while( ReadNode( proc, this, &node ) && !proc.eof() );
|
||||||
|
@ -227,19 +224,19 @@ bool WRL2BASE::isDangling( void )
|
||||||
|
|
||||||
bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( !aParent )
|
if( !aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] invoked with NULL parent";
|
ostr << " * [BUG] invoked with NULL parent";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -248,38 +245,38 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE* ref = aParent->FindNode( glob, NULL );
|
WRL2NODE* ref = aParent->FindNode( glob, nullptr );
|
||||||
|
|
||||||
// return 'true' - the file may be defective but it may still be somewhat OK
|
// return 'true' - the file may be defective but it may still be somewhat OK
|
||||||
if( NULL == ref )
|
if( nullptr == ref )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] node '" << glob << "' not found";
|
ostr << " * [INFO] node '" << glob << "' not found";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aParent->AddRefNode( ref ) )
|
if( !aParent->AddRefNode( ref ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -288,12 +285,12 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
|
ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = ref;
|
*aNode = ref;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -302,36 +299,36 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
|
|
||||||
bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] invalid parent pointer (NULL)";
|
ostr << " * [BUG] invalid parent pointer (NULL)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string glob;
|
std::string glob;
|
||||||
WRL2NODE* lnode = NULL;
|
WRL2NODE* lnode = nullptr;
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -341,12 +338,12 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
|
|
||||||
if( ReadNode( proc, aParent, &lnode ) )
|
if( ReadNode( proc, aParent, &lnode ) )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = lnode;
|
*aNode = lnode;
|
||||||
|
|
||||||
if( lnode && !lnode->SetName( glob ) )
|
if( lnode && !lnode->SetName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
size_t line, column;
|
size_t line, column;
|
||||||
|
@ -356,7 +353,7 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -376,19 +373,19 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
// must always check the value of aNode when the function returns
|
// must always check the value of aNode when the function returns
|
||||||
// 'true' since it will be NULL if the node type is not supported.
|
// 'true' since it will be NULL if the node type is not supported.
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( NULL == aParent )
|
if( nullptr == aParent )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] invalid parent pointer (NULL)";
|
ostr << " * [BUG] invalid parent pointer (NULL)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +395,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
if( !proc.eof() )
|
if( !proc.eof() )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -406,7 +403,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -426,14 +423,14 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !implementUse( proc, aParent, aNode ) )
|
if( !implementUse( proc, aParent, aNode ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -445,14 +442,14 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !implementDef( proc, aParent, aNode ) )
|
if( !implementDef( proc, aParent, aNode ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -465,14 +462,14 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadName( glob ) || !proc.DiscardList() )
|
if( !proc.ReadName( glob ) || !proc.DiscardList() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -485,14 +482,14 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadName( glob ) || !proc.ReadName( glob ) || !proc.DiscardList() )
|
if( !proc.ReadName( glob ) || !proc.ReadName( glob ) || !proc.DiscardList() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -505,14 +502,14 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) )
|
if( !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -525,13 +522,13 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
size_t column = 0;
|
size_t column = 0;
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
|
ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( ntype )
|
switch( ntype )
|
||||||
{
|
{
|
||||||
|
@ -563,18 +560,18 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
// XXX - IMPLEMENT
|
// XXX - IMPLEMENT
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
|
@ -584,7 +581,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -599,18 +596,18 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
// XXX - IMPLEMENT
|
// XXX - IMPLEMENT
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -618,7 +615,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -626,18 +623,18 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
// XXX - IMPLEMENT
|
// XXX - IMPLEMENT
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
|
@ -647,7 +644,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -655,18 +652,18 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
// XXX - IMPLEMENT
|
// XXX - IMPLEMENT
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -674,7 +671,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -724,18 +721,18 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
// XXX - IMPLEMENT
|
// XXX - IMPLEMENT
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
ostr << " * [INFO] FAIL: discard " << glob << " node at l";
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -743,7 +740,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -814,7 +811,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -823,11 +820,11 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << ", column " << column;
|
ostr << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -835,7 +832,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << line << ", c" << column;
|
ostr << line << ", c" << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -847,7 +844,7 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
bool WRL2BASE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
bool WRL2BASE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
// this function makes no sense in the base node
|
// this function makes no sense in the base node
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -855,7 +852,7 @@ bool WRL2BASE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [BUG] this method must never be invoked on a WRL2BASE object";
|
ostr << " * [BUG] this method must never be invoked on a WRL2BASE object";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -863,8 +860,8 @@ bool WRL2BASE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2TRANSFORM* np = new WRL2TRANSFORM( aParent );
|
WRL2TRANSFORM* np = new WRL2TRANSFORM( aParent );
|
||||||
|
|
||||||
|
@ -874,7 +871,7 @@ bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -883,8 +880,8 @@ bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
|
|
||||||
bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2SHAPE* np = new WRL2SHAPE( aParent );
|
WRL2SHAPE* np = new WRL2SHAPE( aParent );
|
||||||
|
|
||||||
|
@ -894,7 +891,7 @@ bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -903,8 +900,8 @@ bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2APPEARANCE* np = new WRL2APPEARANCE( aParent );
|
WRL2APPEARANCE* np = new WRL2APPEARANCE( aParent );
|
||||||
|
|
||||||
|
@ -914,7 +911,7 @@ bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNod
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -923,8 +920,8 @@ bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNod
|
||||||
|
|
||||||
bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2MATERIAL* np = new WRL2MATERIAL( aParent );
|
WRL2MATERIAL* np = new WRL2MATERIAL( aParent );
|
||||||
|
|
||||||
|
@ -934,7 +931,7 @@ bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -943,8 +940,8 @@ bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
|
|
||||||
bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2FACESET* np = new WRL2FACESET( aParent );
|
WRL2FACESET* np = new WRL2FACESET( aParent );
|
||||||
|
|
||||||
|
@ -954,7 +951,7 @@ bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -963,8 +960,8 @@ bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2LINESET* np = new WRL2LINESET( aParent );
|
WRL2LINESET* np = new WRL2LINESET( aParent );
|
||||||
|
|
||||||
|
@ -974,7 +971,7 @@ bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -983,8 +980,8 @@ bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2POINTSET* np = new WRL2POINTSET( aParent );
|
WRL2POINTSET* np = new WRL2POINTSET( aParent );
|
||||||
|
|
||||||
|
@ -994,7 +991,7 @@ bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1003,8 +1000,8 @@ bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
||||||
|
|
||||||
bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2COORDS* np = new WRL2COORDS( aParent );
|
WRL2COORDS* np = new WRL2COORDS( aParent );
|
||||||
|
|
||||||
|
@ -1014,7 +1011,7 @@ bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1023,8 +1020,8 @@ bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2NORMS* np = new WRL2NORMS( aParent );
|
WRL2NORMS* np = new WRL2NORMS( aParent );
|
||||||
|
|
||||||
|
@ -1034,7 +1031,7 @@ bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1043,8 +1040,8 @@ bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2COLOR* np = new WRL2COLOR( aParent );
|
WRL2COLOR* np = new WRL2COLOR( aParent );
|
||||||
|
|
||||||
|
@ -1054,7 +1051,7 @@ bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1063,8 +1060,8 @@ bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2BOX* np = new WRL2BOX( aParent );
|
WRL2BOX* np = new WRL2BOX( aParent );
|
||||||
|
|
||||||
|
@ -1074,7 +1071,7 @@ bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1083,8 +1080,8 @@ bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
WRL2SWITCH* np = new WRL2SWITCH( aParent );
|
WRL2SWITCH* np = new WRL2SWITCH( aParent );
|
||||||
|
|
||||||
|
@ -1094,7 +1091,7 @@ bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1103,8 +1100,8 @@ bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
{
|
{
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = NULL;
|
*aNode = nullptr;
|
||||||
|
|
||||||
if( !m_useInline )
|
if( !m_useInline )
|
||||||
{
|
{
|
||||||
|
@ -1114,7 +1111,7 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
|
|
||||||
if( !proc.DiscardNode() )
|
if( !proc.DiscardNode() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -1123,7 +1120,7 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
ostr << ", column " << column;
|
ostr << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1136,7 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != aNode )
|
if( nullptr != aNode )
|
||||||
*aNode = (WRL2NODE*) np;
|
*aNode = (WRL2NODE*) np;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1149,13 +1146,13 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||||
SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( m_Children.empty() )
|
if( m_Children.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -1163,24 +1160,24 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1209,7 +1206,7 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
||||||
IFSG_TRANSFORM wrapper( topNode.GetRawPtr() );
|
IFSG_TRANSFORM wrapper( topNode.GetRawPtr() );
|
||||||
SGNODE* pshape = (*sC)->TranslateToSG( wrapper.GetRawPtr() );
|
SGNODE* pshape = (*sC)->TranslateToSG( wrapper.GetRawPtr() );
|
||||||
|
|
||||||
if( NULL != pshape )
|
if( nullptr != pshape )
|
||||||
test = true;
|
test = true;
|
||||||
else
|
else
|
||||||
wrapper.Destroy();
|
wrapper.Destroy();
|
||||||
|
@ -1222,7 +1219,7 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
||||||
case WRL2NODES::WRL2_SWITCH:
|
case WRL2NODES::WRL2_SWITCH:
|
||||||
case WRL2NODES::WRL2_INLINE:
|
case WRL2NODES::WRL2_INLINE:
|
||||||
|
|
||||||
if( NULL != (*sC)->TranslateToSG( topNode.GetRawPtr() ) )
|
if( nullptr != (*sC)->TranslateToSG( topNode.GetRawPtr() ) )
|
||||||
test = true;
|
test = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1237,7 +1234,7 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
||||||
if( false == test )
|
if( false == test )
|
||||||
{
|
{
|
||||||
topNode.Destroy();
|
topNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sgNode = topNode.GetRawPtr();
|
m_sgNode = topNode.GetRawPtr();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,8 +38,6 @@ WRL2BOX::WRL2BOX() : WRL2NODE()
|
||||||
size.x = 2.0;
|
size.x = 2.0;
|
||||||
size.y = 2.0;
|
size.y = 2.0;
|
||||||
size.z = 2.0;
|
size.z = 2.0;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,20 +49,14 @@ WRL2BOX::WRL2BOX( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
size.y = 2.0;
|
size.y = 2.0;
|
||||||
size.z = 2.0;
|
size.z = 2.0;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2BOX::~WRL2BOX()
|
WRL2BOX::~WRL2BOX()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Box node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Box node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +64,7 @@ bool WRL2BOX::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -87,7 +80,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -95,14 +88,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -111,7 +104,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -127,14 +120,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +139,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( size ) )
|
if( !proc.ReadSFVec3f( size ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -156,7 +149,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +159,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -175,14 +168,14 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( size.x < 1e-6 || size.y < 1e-6 || size.z < 1e-6 )
|
if( size.x < 1e-6 || size.y < 1e-6 || size.z < 1e-6 )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -191,7 +184,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if( proc.Peek() == '}' )
|
if( proc.Peek() == '}' )
|
||||||
|
@ -202,7 +195,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -211,7 +204,7 @@ bool WRL2BOX::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -221,14 +214,14 @@ bool WRL2BOX::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -238,14 +231,14 @@ bool WRL2BOX::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -255,9 +248,9 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -265,28 +258,28 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do not render a bad box
|
// do not render a bad box
|
||||||
if( size.x < 1e-6 || size.y < 1e-6 || size.z < 1e-6 )
|
if( size.x < 1e-6 || size.y < 1e-6 || size.z < 1e-6 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,6 +294,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
std::vector< SGVECTOR > norms;
|
std::vector< SGVECTOR > norms;
|
||||||
std::vector< int > idx;
|
std::vector< int > idx;
|
||||||
int base = 0;
|
int base = 0;
|
||||||
|
|
||||||
// top
|
// top
|
||||||
vertices.emplace_back( -x, -y, z );
|
vertices.emplace_back( -x, -y, z );
|
||||||
vertices.emplace_back( x, -y, z );
|
vertices.emplace_back( x, -y, z );
|
||||||
|
@ -317,6 +311,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
idx.push_back( base + 2 );
|
idx.push_back( base + 2 );
|
||||||
idx.push_back( base + 3 );
|
idx.push_back( base + 3 );
|
||||||
base += 4;
|
base += 4;
|
||||||
|
|
||||||
// bottom
|
// bottom
|
||||||
vertices.emplace_back( -x, -y, -z );
|
vertices.emplace_back( -x, -y, -z );
|
||||||
vertices.emplace_back( x, -y, -z );
|
vertices.emplace_back( x, -y, -z );
|
||||||
|
@ -333,6 +328,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
idx.push_back( base + 3 );
|
idx.push_back( base + 3 );
|
||||||
idx.push_back( base + 2 );
|
idx.push_back( base + 2 );
|
||||||
base += 4;
|
base += 4;
|
||||||
|
|
||||||
// front
|
// front
|
||||||
vertices.emplace_back( -x, -y, z );
|
vertices.emplace_back( -x, -y, z );
|
||||||
vertices.emplace_back( -x, -y, -z );
|
vertices.emplace_back( -x, -y, -z );
|
||||||
|
@ -349,6 +345,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
idx.push_back( base + 2 );
|
idx.push_back( base + 2 );
|
||||||
idx.push_back( base + 3 );
|
idx.push_back( base + 3 );
|
||||||
base += 4;
|
base += 4;
|
||||||
|
|
||||||
// back
|
// back
|
||||||
vertices.emplace_back( -x, y, z );
|
vertices.emplace_back( -x, y, z );
|
||||||
vertices.emplace_back( -x, y, -z );
|
vertices.emplace_back( -x, y, -z );
|
||||||
|
@ -365,6 +362,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
idx.push_back( base + 3 );
|
idx.push_back( base + 3 );
|
||||||
idx.push_back( base + 2 );
|
idx.push_back( base + 2 );
|
||||||
base += 4;
|
base += 4;
|
||||||
|
|
||||||
// left
|
// left
|
||||||
vertices.emplace_back( -x, -y, -z );
|
vertices.emplace_back( -x, -y, -z );
|
||||||
vertices.emplace_back( -x, -y, z );
|
vertices.emplace_back( -x, -y, z );
|
||||||
|
@ -381,6 +379,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
||||||
idx.push_back( base + 2 );
|
idx.push_back( base + 2 );
|
||||||
idx.push_back( base + 3 );
|
idx.push_back( base + 3 );
|
||||||
base += 4;
|
base += 4;
|
||||||
|
|
||||||
// right
|
// right
|
||||||
vertices.emplace_back( x, -y, -z );
|
vertices.emplace_back( x, -y, -z );
|
||||||
vertices.emplace_back( x, -y, z );
|
vertices.emplace_back( x, -y, z );
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
WRL2COLOR::WRL2COLOR() : WRL2NODE()
|
WRL2COLOR::WRL2COLOR() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_Type = WRL2NODES::WRL2_COLOR;
|
m_Type = WRL2NODES::WRL2_COLOR;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,20 +42,14 @@ WRL2COLOR::WRL2COLOR( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_COLOR;
|
m_Type = WRL2NODES::WRL2_COLOR;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2COLOR::~WRL2COLOR()
|
WRL2COLOR::~WRL2COLOR()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Color node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Color node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +57,7 @@ bool WRL2COLOR::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_INDEXEDFACESET
|
// this node is dangling unless it has a parent of type WRL2_INDEXEDFACESET
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_INDEXEDFACESET )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_INDEXEDFACESET )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,14 +68,14 @@ bool WRL2COLOR::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -91,14 +85,14 @@ bool WRL2COLOR::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +107,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -121,14 +115,14 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -137,7 +131,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,14 +147,14 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +166,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( colors ) )
|
if( !proc.ReadMFVec3f( colors ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -182,14 +176,14 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -198,7 +192,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +205,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -220,7 +214,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +223,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
SGNODE* WRL2COLOR::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2COLOR::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
// any data manipulation must be performed by the parent node
|
// any data manipulation must be performed by the parent node
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,8 +249,6 @@ void WRL2COLOR::GetColor( int aIndex, float& red, float& green, float& blue )
|
||||||
red = colors[aIndex].x;
|
red = colors[aIndex].x;
|
||||||
green = colors[aIndex].y;
|
green = colors[aIndex].y;
|
||||||
blue = colors[aIndex].z;
|
blue = colors[aIndex].z;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,13 +256,11 @@ void WRL2COLOR::GetColors( WRLVEC3F*& aColorList, size_t& aListSize)
|
||||||
{
|
{
|
||||||
if( colors.empty() )
|
if( colors.empty() )
|
||||||
{
|
{
|
||||||
aColorList = NULL;
|
aColorList = nullptr;
|
||||||
aListSize = 0;
|
aListSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aColorList = &colors[0];
|
aColorList = &colors[0];
|
||||||
aListSize = colors.size();
|
aListSize = colors.size();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
WRL2COORDS::WRL2COORDS() : WRL2NODE()
|
WRL2COORDS::WRL2COORDS() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_Type = WRL2NODES::WRL2_COORDINATE;
|
m_Type = WRL2NODES::WRL2_COORDINATE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,20 +42,14 @@ WRL2COORDS::WRL2COORDS( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_COORDINATE;
|
m_Type = WRL2NODES::WRL2_COORDINATE;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2COORDS::~WRL2COORDS()
|
WRL2COORDS::~WRL2COORDS()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +57,7 @@ bool WRL2COORDS::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_INDEXEDFACESET
|
// this node is dangling unless it has a parent of type WRL2_INDEXEDFACESET
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_INDEXEDFACESET )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_INDEXEDFACESET )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,14 +68,14 @@ bool WRL2COORDS::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -91,14 +85,14 @@ bool WRL2COORDS::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable\n";
|
ostr << " * [BUG] AddChildNode is not applicable\n";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +107,7 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -121,14 +115,14 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -137,7 +131,7 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,14 +147,14 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +166,7 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( points ) )
|
if( !proc.ReadMFVec3f( points ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -182,26 +176,26 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad Coordinate at line " << line << ", column ";
|
ostr << " * [INFO] bad Coordinate at line " << line << ", column ";
|
||||||
ostr << column << "\n";
|
ostr << column << "\n";
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assuming legacy kicad expectation of 1U = 0.1 inch,
|
// assuming legacy KiCad expectation of 1U = 0.1 inch,
|
||||||
// convert to mm to meet the expectations of the SG structure
|
// convert to mm to meet the expectations of the SG structure
|
||||||
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
||||||
std::vector< WRLVEC3F >::iterator eP = points.end();
|
std::vector< WRLVEC3F >::iterator eP = points.end();
|
||||||
|
@ -222,7 +216,7 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -231,7 +225,7 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -241,19 +235,18 @@ void WRL2COORDS::GetCoords( WRLVEC3F*& aCoordList, size_t& aListSize )
|
||||||
{
|
{
|
||||||
if( points.size() < 3 )
|
if( points.size() < 3 )
|
||||||
{
|
{
|
||||||
aCoordList = NULL;
|
aCoordList = nullptr;
|
||||||
aListSize = 0;
|
aListSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aCoordList = &points[0];
|
aCoordList = &points[0];
|
||||||
aListSize = points.size();
|
aListSize = points.size();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SGNODE* WRL2COORDS::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2COORDS::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
// any data manipulation must be performed by the parent node
|
// any data manipulation must be performed by the parent node
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -38,8 +39,6 @@ WRL2FACESET::WRL2FACESET() : WRL2NODE()
|
||||||
{
|
{
|
||||||
setDefaults();
|
setDefaults();
|
||||||
m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
|
m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,16 +48,14 @@ WRL2FACESET::WRL2FACESET( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
|
m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2FACESET::~WRL2FACESET()
|
WRL2FACESET::~WRL2FACESET()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size();
|
ostr << " * [INFO] Destroying IndexedFaceSet with " << m_Children.size();
|
||||||
|
@ -66,18 +63,16 @@ WRL2FACESET::~WRL2FACESET()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2FACESET::setDefaults( void )
|
void WRL2FACESET::setDefaults( void )
|
||||||
{
|
{
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
normal = NULL;
|
normal = nullptr;
|
||||||
texCoord = NULL;
|
texCoord = nullptr;
|
||||||
|
|
||||||
ccw = true;
|
ccw = true;
|
||||||
colorPerVertex = true;
|
colorPerVertex = true;
|
||||||
|
@ -119,7 +114,7 @@ bool WRL2FACESET::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -128,16 +123,16 @@ bool WRL2FACESET::isDangling( void )
|
||||||
|
|
||||||
bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +141,7 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -154,23 +149,23 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COLOR == type )
|
if( WRL2NODES::WRL2_COLOR == type )
|
||||||
{
|
{
|
||||||
if( NULL != color )
|
if( nullptr != color )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple color nodes";
|
ostr << " * [INFO] bad file format; multiple color nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -181,16 +176,16 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||||
{
|
{
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -201,16 +196,16 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_NORMAL == type )
|
if( WRL2NODES::WRL2_NORMAL == type )
|
||||||
{
|
{
|
||||||
if( NULL != normal )
|
if( nullptr != normal )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple normal nodes";
|
ostr << " * [INFO] bad file format; multiple normal nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -221,28 +216,28 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_TEXTURECOORDINATE != type )
|
if( WRL2NODES::WRL2_TEXTURECOORDINATE != type )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] unexpected code branch";
|
ostr << " * [BUG] unexpected code branch";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != texCoord )
|
if( nullptr != texCoord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple texCoord nodes";
|
ostr << " * [INFO] bad file format; multiple texCoord nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -254,16 +249,16 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +267,7 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -280,23 +275,23 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COLOR == type )
|
if( WRL2NODES::WRL2_COLOR == type )
|
||||||
{
|
{
|
||||||
if( NULL != color )
|
if( nullptr != color )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple color nodes";
|
ostr << " * [INFO] bad file format; multiple color nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -307,16 +302,16 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||||
{
|
{
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -327,16 +322,16 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_NORMAL == type )
|
if( WRL2NODES::WRL2_NORMAL == type )
|
||||||
{
|
{
|
||||||
if( NULL != normal )
|
if( nullptr != normal )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple normal nodes";
|
ostr << " * [INFO] bad file format; multiple normal nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -347,28 +342,28 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_TEXTURECOORDINATE != type )
|
if( WRL2NODES::WRL2_TEXTURECOORDINATE != type )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] unexpected code branch";
|
ostr << " * [BUG] unexpected code branch";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != texCoord )
|
if( nullptr != texCoord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple texCoord nodes";
|
ostr << " * [INFO] bad file format; multiple texCoord nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +383,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -396,14 +391,14 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -412,7 +407,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -430,14 +425,14 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +462,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFBool( ccw ) )
|
if( !proc.ReadSFBool( ccw ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -477,7 +472,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -486,7 +481,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFBool( colorPerVertex ) )
|
if( !proc.ReadSFBool( colorPerVertex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -496,7 +491,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -505,7 +500,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFBool( convex ) )
|
if( !proc.ReadSFBool( convex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -515,7 +510,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -524,7 +519,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFBool( normalPerVertex ) )
|
if( !proc.ReadSFBool( normalPerVertex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -534,7 +529,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -543,7 +538,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFBool( solid ) )
|
if( !proc.ReadSFBool( solid ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -553,7 +548,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -562,7 +557,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFFloat( creaseAngle ) )
|
if( !proc.ReadSFFloat( creaseAngle ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -572,7 +567,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'\n";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'\n";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +583,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( colorIndex ) )
|
if( !proc.ReadMFInt( colorIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -598,7 +593,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -607,7 +602,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( coordIndex ) )
|
if( !proc.ReadMFInt( coordIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -617,7 +612,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +621,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( normalIndex ) )
|
if( !proc.ReadMFInt( normalIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -636,78 +631,78 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "color" ) )
|
else if( !glob.compare( "color" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read color node information";
|
ostr << " * [INFO] could not read color node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "coord" ) )
|
else if( !glob.compare( "coord" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read coord node information";
|
ostr << " * [INFO] could not read coord node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "normal" ) )
|
else if( !glob.compare( "normal" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read normal node information";
|
ostr << " * [INFO] could not read normal node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "texCoord" ) )
|
else if( !glob.compare( "texCoord" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read texCoord node information";
|
ostr << " * [INFO] could not read texCoord node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -716,7 +711,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -730,9 +725,9 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -740,12 +735,12 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size();
|
ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size();
|
||||||
|
@ -754,21 +749,21 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << coordIndex.size() << " coord indices";
|
ostr << coordIndex.size() << " coord indices";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,15 +772,15 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
size_t vsize = coordIndex.size();
|
size_t vsize = coordIndex.size();
|
||||||
|
|
||||||
if( NULL == coord || vsize < 3 )
|
if( nullptr == coord || vsize < 3 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
WRLVEC3F* pcoords;
|
WRLVEC3F* pcoords;
|
||||||
size_t coordsize;
|
size_t coordsize;
|
||||||
((WRL2COORDS*) coord)->GetCoords( pcoords, coordsize );
|
((WRL2COORDS*) coord)->GetCoords( pcoords, coordsize );
|
||||||
|
|
||||||
if( coordsize < 3 )
|
if( coordsize < 3 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
// check that all indices are valid
|
// check that all indices are valid
|
||||||
for( size_t idx = 0; idx < vsize; ++idx )
|
for( size_t idx = 0; idx < vsize; ++idx )
|
||||||
|
@ -794,17 +789,17 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( coordIndex[idx] >= (int)coordsize )
|
if( coordIndex[idx] >= (int)coordsize )
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAPE lShape;
|
SHAPE lShape;
|
||||||
FACET* fp = NULL;
|
FACET* fp = nullptr;
|
||||||
size_t iCoord;
|
size_t iCoord;
|
||||||
int idx; // coordinate index
|
int idx; // coordinate index
|
||||||
size_t cidx = 0; // color index
|
size_t cidx = 0; // color index
|
||||||
SGCOLOR pc1;
|
SGCOLOR pc1;
|
||||||
|
|
||||||
if( NULL == color )
|
if( nullptr == color )
|
||||||
{
|
{
|
||||||
// no per-vertex colors; we can save a few CPU cycles
|
// no per-vertex colors; we can save a few CPU cycles
|
||||||
for( iCoord = 0; iCoord < vsize; ++iCoord )
|
for( iCoord = 0; iCoord < vsize; ++iCoord )
|
||||||
|
@ -813,10 +808,10 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
if( idx < 0 )
|
if( idx < 0 )
|
||||||
{
|
{
|
||||||
if( NULL != fp )
|
if( nullptr != fp )
|
||||||
{
|
{
|
||||||
if( fp->HasMinPoints() )
|
if( fp->HasMinPoints() )
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
else
|
else
|
||||||
fp->Init();
|
fp->Init();
|
||||||
}
|
}
|
||||||
|
@ -828,7 +823,7 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
if( idx >= (int)coordsize )
|
if( idx >= (int)coordsize )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( NULL == fp )
|
if( nullptr == fp )
|
||||||
fp = lShape.NewFacet();
|
fp = lShape.NewFacet();
|
||||||
|
|
||||||
// push the vertex value and index
|
// push the vertex value and index
|
||||||
|
@ -846,10 +841,10 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
if( idx < 0 )
|
if( idx < 0 )
|
||||||
{
|
{
|
||||||
if( NULL != fp )
|
if( nullptr != fp )
|
||||||
{
|
{
|
||||||
if( fp->HasMinPoints() )
|
if( fp->HasMinPoints() )
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
else
|
else
|
||||||
fp->Init();
|
fp->Init();
|
||||||
}
|
}
|
||||||
|
@ -864,7 +859,7 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
if( idx >= (int)coordsize )
|
if( idx >= (int)coordsize )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( NULL == fp )
|
if( nullptr == fp )
|
||||||
fp = lShape.NewFacet();
|
fp = lShape.NewFacet();
|
||||||
|
|
||||||
// push the vertex value and index
|
// push the vertex value and index
|
||||||
|
@ -912,12 +907,12 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SGNODE* np = NULL;
|
SGNODE* np = nullptr;
|
||||||
|
|
||||||
if( ccw )
|
if( ccw )
|
||||||
np = lShape.CalcShape( aParent, NULL, WRL1_ORDER::ORD_CCW, creaseLimit, true );
|
np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CCW, creaseLimit, true );
|
||||||
else
|
else
|
||||||
np = lShape.CalcShape( aParent, NULL, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
||||||
|
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
|
@ -925,54 +920,50 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
void WRL2FACESET::unlinkChildNode( const WRL2NODE* aNode )
|
void WRL2FACESET::unlinkChildNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() == this )
|
if( aNode->GetParent() == this )
|
||||||
{
|
{
|
||||||
if( aNode == color )
|
if( aNode == color )
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
else if( aNode == coord )
|
else if( aNode == coord )
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
else if( aNode == normal )
|
else if( aNode == normal )
|
||||||
normal = NULL;
|
normal = nullptr;
|
||||||
else if( aNode == texCoord )
|
else if( aNode == texCoord )
|
||||||
texCoord = NULL;
|
texCoord = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkChildNode( aNode );
|
WRL2NODE::unlinkChildNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2FACESET::unlinkRefNode( const WRL2NODE* aNode )
|
void WRL2FACESET::unlinkRefNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() != this )
|
if( aNode->GetParent() != this )
|
||||||
{
|
{
|
||||||
if( aNode == color )
|
if( aNode == color )
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
else if( aNode == coord )
|
else if( aNode == coord )
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
else if( aNode == normal )
|
else if( aNode == normal )
|
||||||
normal = NULL;
|
normal = nullptr;
|
||||||
else if( aNode == texCoord )
|
else if( aNode == texCoord )
|
||||||
texCoord = NULL;
|
texCoord = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkRefNode( aNode );
|
WRL2NODE::unlinkRefNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool WRL2FACESET::HasColors( void )
|
bool WRL2FACESET::HasColors( void )
|
||||||
{
|
{
|
||||||
if( NULL == color )
|
if( nullptr == color )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((WRL2COLOR*) color)->HasColors();
|
return ( (WRL2COLOR*) color )->HasColors();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,34 +34,26 @@
|
||||||
|
|
||||||
WRL2INLINE::WRL2INLINE() : WRL2NODE()
|
WRL2INLINE::WRL2INLINE() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_VRML2Base = NULL;
|
m_VRML2Base = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_INLINE;
|
m_Type = WRL2NODES::WRL2_INLINE;
|
||||||
m_Parent = NULL;
|
m_Parent = nullptr;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2INLINE::WRL2INLINE( WRL2NODE* aParent ) : WRL2NODE()
|
WRL2INLINE::WRL2INLINE( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_VRML2Base = NULL;
|
m_VRML2Base = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_INLINE;
|
m_Type = WRL2NODES::WRL2_INLINE;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2INLINE::~WRL2INLINE()
|
WRL2INLINE::~WRL2INLINE()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Inline node\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Inline node\n" );
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +66,7 @@ bool WRL2INLINE::isDangling( void )
|
||||||
|
|
||||||
bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( aTopNode == NULL || aTopNode->GetNodeType() != WRL2NODES::WRL2_BASE )
|
if( aTopNode == nullptr || aTopNode->GetNodeType() != WRL2NODES::WRL2_BASE )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_VRML2Base = aTopNode;
|
m_VRML2Base = aTopNode;
|
||||||
|
@ -83,7 +76,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -91,14 +84,14 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -107,7 +100,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -126,14 +119,14 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +138,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFString( url ) )
|
if( !proc.ReadMFString( url ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -155,7 +148,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +157,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( bboxCenter ) )
|
if( !proc.ReadSFVec3f( bboxCenter ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -174,7 +167,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +176,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( bboxSize ) )
|
if( !proc.ReadSFVec3f( bboxSize ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -193,14 +186,14 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -209,7 +202,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +210,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -226,7 +219,7 @@ bool WRL2INLINE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -236,14 +229,14 @@ bool WRL2INLINE::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -253,14 +246,14 @@ bool WRL2INLINE::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable\n";
|
ostr << " * [BUG] AddChildNode is not applicable\n";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -268,17 +261,17 @@ bool WRL2INLINE::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
SGNODE* WRL2INLINE::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2INLINE::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == aParent || NULL == m_VRML2Base )
|
if( nullptr == aParent || nullptr == m_VRML2Base )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( url.empty() )
|
if( url.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( ptype != S3D::SGTYPE_TRANSFORM )
|
if( ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -286,25 +279,25 @@ SGNODE* WRL2INLINE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGNODE* np = m_VRML2Base->GetInlineData( url.front() );
|
SGNODE* np = m_VRML2Base->GetInlineData( url.front() );
|
||||||
|
|
||||||
if( NULL == np )
|
if( nullptr == np )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
bool OK = false;
|
bool OK = false;
|
||||||
|
|
||||||
if( NULL == S3D::GetSGNodeParent( np ) )
|
if( nullptr == S3D::GetSGNodeParent( np ) )
|
||||||
OK = S3D::AddSGNodeChild( aParent, np );
|
OK = S3D::AddSGNodeChild( aParent, np );
|
||||||
else
|
else
|
||||||
OK = S3D::AddSGNodeRef( aParent, np );
|
OK = S3D::AddSGNodeRef( aParent, np );
|
||||||
|
|
||||||
if( !OK )
|
if( !OK )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,8 +38,6 @@ WRL2LINESET::WRL2LINESET() : WRL2NODE()
|
||||||
{
|
{
|
||||||
setDefaults();
|
setDefaults();
|
||||||
m_Type = WRL2NODES::WRL2_INDEXEDLINESET;
|
m_Type = WRL2NODES::WRL2_INDEXEDLINESET;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,16 +47,14 @@ WRL2LINESET::WRL2LINESET( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_INDEXEDLINESET;
|
m_Type = WRL2NODES::WRL2_INDEXEDLINESET;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2LINESET::~WRL2LINESET()
|
WRL2LINESET::~WRL2LINESET()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying IndexedLineSet with " << m_Children.size();
|
ostr << " * [INFO] Destroying IndexedLineSet with " << m_Children.size();
|
||||||
|
@ -65,16 +62,14 @@ WRL2LINESET::~WRL2LINESET()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2LINESET::setDefaults( void )
|
void WRL2LINESET::setDefaults( void )
|
||||||
{
|
{
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
colorPerVertex = true;
|
colorPerVertex = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +99,7 @@ bool WRL2LINESET::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -113,16 +108,16 @@ bool WRL2LINESET::isDangling( void )
|
||||||
|
|
||||||
bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +126,7 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -139,23 +134,23 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COLOR == type )
|
if( WRL2NODES::WRL2_COLOR == type )
|
||||||
{
|
{
|
||||||
if( NULL != color )
|
if( nullptr != color )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple color nodes";
|
ostr << " * [INFO] bad file format; multiple color nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -166,16 +161,16 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||||
{
|
{
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -190,16 +185,16 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +203,7 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -216,23 +211,23 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COLOR == type )
|
if( WRL2NODES::WRL2_COLOR == type )
|
||||||
{
|
{
|
||||||
if( NULL != color )
|
if( nullptr != color )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple color nodes";
|
ostr << " * [INFO] bad file format; multiple color nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -243,16 +238,16 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||||
{
|
{
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +270,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -283,14 +278,14 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -299,7 +294,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -317,14 +312,14 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +340,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFBool( colorPerVertex ) )
|
if( !proc.ReadSFBool( colorPerVertex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -355,7 +350,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +359,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( colorIndex ) )
|
if( !proc.ReadMFInt( colorIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -374,7 +369,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -383,7 +378,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFInt( coordIndex ) )
|
if( !proc.ReadMFInt( coordIndex ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -393,46 +388,46 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "color" ) )
|
else if( !glob.compare( "color" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read color node information";
|
ostr << " * [INFO] could not read color node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "coord" ) )
|
else if( !glob.compare( "coord" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read coord node information";
|
ostr << " * [INFO] could not read coord node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -441,7 +436,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -454,51 +449,47 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
SGNODE* WRL2LINESET::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2LINESET::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
// note: there are no plans to support drawing of lines
|
// note: there are no plans to support drawing of lines
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2LINESET::unlinkChildNode( const WRL2NODE* aNode )
|
void WRL2LINESET::unlinkChildNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() == this )
|
if( aNode->GetParent() == this )
|
||||||
{
|
{
|
||||||
if( aNode == color )
|
if( aNode == color )
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
else if( aNode == coord )
|
else if( aNode == coord )
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkChildNode( aNode );
|
WRL2NODE::unlinkChildNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2LINESET::unlinkRefNode( const WRL2NODE* aNode )
|
void WRL2LINESET::unlinkRefNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() != this )
|
if( aNode->GetParent() != this )
|
||||||
{
|
{
|
||||||
if( aNode == color )
|
if( aNode == color )
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
else if( aNode == coord )
|
else if( aNode == coord )
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkRefNode( aNode );
|
WRL2NODE::unlinkRefNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool WRL2LINESET::HasColors( void )
|
bool WRL2LINESET::HasColors( void )
|
||||||
{
|
{
|
||||||
if( NULL == color )
|
if( nullptr == color )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((WRL2COLOR*) color)->HasColors();
|
return ((WRL2COLOR*) color)->HasColors();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -35,7 +36,6 @@ WRL2MATERIAL::WRL2MATERIAL() : WRL2NODE()
|
||||||
{
|
{
|
||||||
setDefaults();
|
setDefaults();
|
||||||
m_Type = WRL2NODES::WRL2_MATERIAL;
|
m_Type = WRL2NODES::WRL2_MATERIAL;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,20 +45,14 @@ WRL2MATERIAL::WRL2MATERIAL( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_MATERIAL;
|
m_Type = WRL2NODES::WRL2_MATERIAL;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2MATERIAL::~WRL2MATERIAL()
|
WRL2MATERIAL::~WRL2MATERIAL()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,8 +72,6 @@ void WRL2MATERIAL::setDefaults( void )
|
||||||
ambientIntensity = 0.2f;
|
ambientIntensity = 0.2f;
|
||||||
shininess = 0.2f;
|
shininess = 0.2f;
|
||||||
transparency = 0.0f;
|
transparency = 0.0f;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +79,7 @@ bool WRL2MATERIAL::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2NODES::WRL2_APPEARANCE
|
// this node is dangling unless it has a parent of type WRL2NODES::WRL2_APPEARANCE
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_APPEARANCE )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_APPEARANCE )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,14 +90,14 @@ bool WRL2MATERIAL::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddRefNode is not applicable";
|
ostr << " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -115,14 +107,14 @@ bool WRL2MATERIAL::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] AddChildNode is not applicable";
|
ostr << " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -130,16 +122,16 @@ bool WRL2MATERIAL::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +143,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -159,14 +151,14 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -175,7 +167,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -193,14 +185,14 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +211,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( specularColor ) )
|
if( !proc.ReadSFVec3f( specularColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -229,7 +221,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +230,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( diffuseColor ) )
|
if( !proc.ReadSFVec3f( diffuseColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -248,7 +240,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +249,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( emissiveColor ) )
|
if( !proc.ReadSFVec3f( emissiveColor ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -267,7 +259,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +268,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFFloat( shininess ) )
|
if( !proc.ReadSFFloat( shininess ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -286,7 +278,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +287,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFFloat( transparency ) )
|
if( !proc.ReadSFFloat( transparency ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -305,7 +297,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +306,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFFloat( ambientIntensity ) )
|
if( !proc.ReadSFFloat( ambientIntensity ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -324,14 +316,14 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -340,7 +332,7 @@ bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -354,9 +346,9 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -364,12 +356,12 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Material with " << m_Children.size();
|
ostr << " * [INFO] Translating Material with " << m_Children.size();
|
||||||
|
@ -377,21 +369,21 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -44,8 +45,8 @@ static NODEMAP nodenames;
|
||||||
|
|
||||||
WRL2NODE::WRL2NODE()
|
WRL2NODE::WRL2NODE()
|
||||||
{
|
{
|
||||||
m_sgNode = NULL;
|
m_sgNode = nullptr;
|
||||||
m_Parent = NULL;
|
m_Parent = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_END;
|
m_Type = WRL2NODES::WRL2_END;
|
||||||
|
|
||||||
if( badNames.empty() )
|
if( badNames.empty() )
|
||||||
|
@ -98,12 +99,14 @@ WRL2NODE::WRL2NODE()
|
||||||
nodenames.insert( NODEITEM( "NavigationInfo", WRL2NODES::WRL2_NAVIGATIONINFO ) );
|
nodenames.insert( NODEITEM( "NavigationInfo", WRL2NODES::WRL2_NAVIGATIONINFO ) );
|
||||||
nodenames.insert( NODEITEM( "Normal", WRL2NODES::WRL2_NORMAL ) );
|
nodenames.insert( NODEITEM( "Normal", WRL2NODES::WRL2_NORMAL ) );
|
||||||
nodenames.insert( NODEITEM( "NormalInterpolator", WRL2NODES::WRL2_NORMALINTERPOLATOR ) );
|
nodenames.insert( NODEITEM( "NormalInterpolator", WRL2NODES::WRL2_NORMALINTERPOLATOR ) );
|
||||||
nodenames.insert( NODEITEM( "OrientationInterpolator", WRL2NODES::WRL2_ORIENTATIONINTERPOLATOR ) );
|
nodenames.insert( NODEITEM( "OrientationInterpolator",
|
||||||
|
WRL2NODES::WRL2_ORIENTATIONINTERPOLATOR ) );
|
||||||
nodenames.insert( NODEITEM( "PixelTexture", WRL2NODES::WRL2_PIXELTEXTURE ) );
|
nodenames.insert( NODEITEM( "PixelTexture", WRL2NODES::WRL2_PIXELTEXTURE ) );
|
||||||
nodenames.insert( NODEITEM( "PlaneSensor", WRL2NODES::WRL2_PLANESENSOR ) );
|
nodenames.insert( NODEITEM( "PlaneSensor", WRL2NODES::WRL2_PLANESENSOR ) );
|
||||||
nodenames.insert( NODEITEM( "PointLight", WRL2NODES::WRL2_POINTLIGHT ) );
|
nodenames.insert( NODEITEM( "PointLight", WRL2NODES::WRL2_POINTLIGHT ) );
|
||||||
nodenames.insert( NODEITEM( "PointSet", WRL2NODES::WRL2_POINTSET ) );
|
nodenames.insert( NODEITEM( "PointSet", WRL2NODES::WRL2_POINTSET ) );
|
||||||
nodenames.insert( NODEITEM( "PositionInterpolator", WRL2NODES::WRL2_POSITIONINTERPOLATOR ) );
|
nodenames.insert( NODEITEM( "PositionInterpolator",
|
||||||
|
WRL2NODES::WRL2_POSITIONINTERPOLATOR ) );
|
||||||
nodenames.insert( NODEITEM( "ProximitySensor", WRL2NODES::WRL2_PROXIMITYSENSOR ) );
|
nodenames.insert( NODEITEM( "ProximitySensor", WRL2NODES::WRL2_PROXIMITYSENSOR ) );
|
||||||
nodenames.insert( NODEITEM( "ScalarInterpolator", WRL2NODES::WRL2_SCALARINTERPOLATOR ) );
|
nodenames.insert( NODEITEM( "ScalarInterpolator", WRL2NODES::WRL2_SCALARINTERPOLATOR ) );
|
||||||
nodenames.insert( NODEITEM( "Script", WRL2NODES::WRL2_SCRIPT ) );
|
nodenames.insert( NODEITEM( "Script", WRL2NODES::WRL2_SCRIPT ) );
|
||||||
|
@ -123,8 +126,6 @@ WRL2NODE::WRL2NODE()
|
||||||
nodenames.insert( NODEITEM( "VisibilitySensor", WRL2NODES::WRL2_VISIBILITYSENSOR ) );
|
nodenames.insert( NODEITEM( "VisibilitySensor", WRL2NODES::WRL2_VISIBILITYSENSOR ) );
|
||||||
nodenames.insert( NODEITEM( "WorldInfo", WRL2NODES::WRL2_WORLDINFO ) );
|
nodenames.insert( NODEITEM( "WorldInfo", WRL2NODES::WRL2_WORLDINFO ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,13 +158,12 @@ WRL2NODE::~WRL2NODE()
|
||||||
|
|
||||||
while( sC != eC )
|
while( sC != eC )
|
||||||
{
|
{
|
||||||
(*sC)->SetParent( NULL, false );
|
(*sC)->SetParent( nullptr, false );
|
||||||
delete *sC;
|
delete *sC;
|
||||||
++sC;
|
++sC;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Children.clear();
|
m_Children.clear();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,8 +180,6 @@ void WRL2NODE::addNodeRef( WRL2NODE* aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_BackPointers.push_back( aNode );
|
m_BackPointers.push_back( aNode );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,16 +194,14 @@ void WRL2NODE::delNodeRef( WRL2NODE* aNode )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] delNodeRef() did not find its target";
|
ostr << " * [BUG] delNodeRef() did not find its target";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,14 +232,14 @@ bool WRL2NODE::SetName( const std::string& aName )
|
||||||
|
|
||||||
if( item != badNames.end() )
|
if( item != badNames.end() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] invalid node name '" << *item << "' (matches restricted word)";
|
ostr << " * [INFO] invalid node name '" << *item << "' (matches restricted word)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -251,14 +247,14 @@ bool WRL2NODE::SetName( const std::string& aName )
|
||||||
|
|
||||||
if( isdigit( aName[0] ) )
|
if( isdigit( aName[0] ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] invalid node name '" << *item << "' (begins with digit)";
|
ostr << " * [INFO] invalid node name '" << *item << "' (begins with digit)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +269,7 @@ bool WRL2NODE::SetName( const std::string& aName )
|
||||||
if( std::string::npos != aName.find_first_of( BAD_CHARS1 )
|
if( std::string::npos != aName.find_first_of( BAD_CHARS1 )
|
||||||
|| std::string::npos != aName.find_first_of( BAD_CHARS2 ) )
|
|| std::string::npos != aName.find_first_of( BAD_CHARS2 ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -281,7 +277,7 @@ bool WRL2NODE::SetName( const std::string& aName )
|
||||||
ostr << "' (contains invalid character)";
|
ostr << "' (contains invalid character)";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +323,7 @@ std::string WRL2NODE::GetError( void )
|
||||||
WRL2NODE* WRL2NODE::FindNode( const std::string& aNodeName, const WRL2NODE *aCaller )
|
WRL2NODE* WRL2NODE::FindNode( const std::string& aNodeName, const WRL2NODE *aCaller )
|
||||||
{
|
{
|
||||||
if( aNodeName.empty() )
|
if( aNodeName.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( !m_Name.compare( aNodeName ) )
|
if( !m_Name.compare( aNodeName ) )
|
||||||
return this;
|
return this;
|
||||||
|
@ -335,7 +331,7 @@ WRL2NODE* WRL2NODE::FindNode( const std::string& aNodeName, const WRL2NODE *aCal
|
||||||
std::list< WRL2NODE* >::iterator sLA = m_Children.begin();
|
std::list< WRL2NODE* >::iterator sLA = m_Children.begin();
|
||||||
std::list< WRL2NODE* >::iterator eLA = m_Children.end();
|
std::list< WRL2NODE* >::iterator eLA = m_Children.end();
|
||||||
|
|
||||||
WRL2NODE* psg = NULL;
|
WRL2NODE* psg = nullptr;
|
||||||
|
|
||||||
while( sLA != eLA )
|
while( sLA != eLA )
|
||||||
{
|
{
|
||||||
|
@ -343,17 +339,18 @@ WRL2NODE* WRL2NODE::FindNode( const std::string& aNodeName, const WRL2NODE *aCal
|
||||||
{
|
{
|
||||||
psg = (*sLA)->FindNode( aNodeName, this );
|
psg = (*sLA)->FindNode( aNodeName, this );
|
||||||
|
|
||||||
if( NULL != psg)
|
if( nullptr != psg )
|
||||||
return psg;
|
return psg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++sLA;
|
++sLA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent && aCaller != m_Parent )
|
if( nullptr != m_Parent && aCaller != m_Parent )
|
||||||
return m_Parent->FindNode( aNodeName, this );
|
return m_Parent->FindNode( aNodeName, this );
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -362,12 +359,12 @@ bool WRL2NODE::SetParent( WRL2NODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -376,19 +373,19 @@ bool WRL2NODE::SetParent( WRL2NODE* aParent, bool doUnlink )
|
||||||
|
|
||||||
bool WRL2NODE::AddChildNode( WRL2NODE* aNode )
|
bool WRL2NODE::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( aNode == NULL )
|
if( aNode == nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( aNode->GetNodeType() == WRL2NODES::WRL2_BASE )
|
if( aNode->GetNodeType() == WRL2NODES::WRL2_BASE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to add a base node to another node";
|
ostr << " * [BUG] attempting to add a base node to another node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -415,30 +412,30 @@ bool WRL2NODE::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2NODE::AddRefNode( WRL2NODE* aNode )
|
bool WRL2NODE::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed as node pointer";
|
ostr << " * [BUG] NULL passed as node pointer";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aNode->GetNodeType() == WRL2NODES::WRL2_BASE )
|
if( aNode->GetNodeType() == WRL2NODES::WRL2_BASE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] attempting to add a base node ref to another base node";
|
ostr << " * [BUG] attempting to add a base node ref to another base node";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -476,8 +473,6 @@ void WRL2NODE::unlinkChildNode( const WRL2NODE* aNode )
|
||||||
|
|
||||||
++sL;
|
++sL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -496,6 +491,4 @@ void WRL2NODE::unlinkRefNode( const WRL2NODE* aNode )
|
||||||
|
|
||||||
++sL;
|
++sL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
WRL2NORMS::WRL2NORMS() : WRL2NODE()
|
WRL2NORMS::WRL2NORMS() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_Type = WRL2NODES::WRL2_NORMAL;
|
m_Type = WRL2NODES::WRL2_NORMAL;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,20 +42,14 @@ WRL2NORMS::WRL2NORMS( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_NORMAL;
|
m_Type = WRL2NODES::WRL2_NORMAL;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2NORMS::~WRL2NORMS()
|
WRL2NORMS::~WRL2NORMS()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 3 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Normal node" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Normal node\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +57,7 @@ bool WRL2NORMS::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_INDEXEDFACESET
|
// this node is dangling unless it has a parent of type WRL2_INDEXEDFACESET
|
||||||
|
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_INDEXEDFACESET )
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_INDEXEDFACESET )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,14 +68,14 @@ bool WRL2NORMS::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr<< " * [BUG] AddRefNode is not applicable";
|
ostr<< " * [BUG] AddRefNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -91,14 +85,14 @@ bool WRL2NORMS::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
// this node may not own or reference any other node
|
// this node may not own or reference any other node
|
||||||
|
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr<< " * [BUG] AddChildNode is not applicable";
|
ostr<< " * [BUG] AddChildNode is not applicable";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +107,7 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -121,14 +115,14 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr<< line << ", column " << column;
|
ostr<< line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< proc.GetError() << "\n";
|
ostr<< proc.GetError() << "\n";
|
||||||
|
@ -137,7 +131,7 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,14 +147,14 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr<< proc.GetError();
|
ostr<< proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +166,7 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadMFVec3f( vectors ) )
|
if( !proc.ReadMFVec3f( vectors ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -182,14 +176,14 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr<< " * [INFO] message: '" << proc.GetError() << "'";
|
ostr<< " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -198,7 +192,7 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr<< " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr<< " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +205,7 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
proc.GetFilePosData( line, column );
|
proc.GetFilePosData( line, column );
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr<< __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -220,7 +214,7 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr<< " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr<< " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -229,5 +223,5 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
SGNODE* WRL2NORMS::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2NORMS::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
// any data manipulation must be performed by the parent node
|
// any data manipulation must be performed by the parent node
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,8 +38,6 @@ WRL2POINTSET::WRL2POINTSET() : WRL2NODE()
|
||||||
{
|
{
|
||||||
setDefaults();
|
setDefaults();
|
||||||
m_Type = WRL2NODES::WRL2_POINTSET;
|
m_Type = WRL2NODES::WRL2_POINTSET;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,16 +47,14 @@ WRL2POINTSET::WRL2POINTSET( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_POINTSET;
|
m_Type = WRL2NODES::WRL2_POINTSET;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2POINTSET::~WRL2POINTSET()
|
WRL2POINTSET::~WRL2POINTSET()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying PointSet with " << m_Children.size();
|
ostr << " * [INFO] Destroying PointSet with " << m_Children.size();
|
||||||
|
@ -65,16 +62,14 @@ WRL2POINTSET::~WRL2POINTSET()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2POINTSET::setDefaults( void )
|
void WRL2POINTSET::setDefaults( void )
|
||||||
{
|
{
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,8 +97,7 @@ bool WRL2POINTSET::checkNodeType( WRL2NODES aType )
|
||||||
bool WRL2POINTSET::isDangling( void )
|
bool WRL2POINTSET::isDangling( void )
|
||||||
{
|
{
|
||||||
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
// this node is dangling unless it has a parent of type WRL2_SHAPE
|
||||||
|
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
||||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -112,16 +106,16 @@ bool WRL2POINTSET::isDangling( void )
|
||||||
|
|
||||||
bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +124,7 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -138,23 +132,23 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COLOR == type )
|
if( WRL2NODES::WRL2_COLOR == type )
|
||||||
{
|
{
|
||||||
if( NULL != color )
|
if( nullptr != color )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple color nodes";
|
ostr << " * [INFO] bad file format; multiple color nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -165,16 +159,16 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||||
{
|
{
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -189,16 +183,16 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +201,7 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -215,23 +209,23 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COLOR == type )
|
if( WRL2NODES::WRL2_COLOR == type )
|
||||||
{
|
{
|
||||||
if( NULL != color )
|
if( nullptr != color )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple color nodes";
|
ostr << " * [INFO] bad file format; multiple color nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -242,16 +236,16 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||||
{
|
{
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
ostr << " * [INFO] bad file format; multiple coordinate nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +268,7 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -282,14 +276,14 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -298,7 +292,7 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -316,14 +310,14 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -336,39 +330,39 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !glob.compare( "color" ) )
|
if( !glob.compare( "color" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read color node information";
|
ostr << " * [INFO] could not read color node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "coord" ) )
|
else if( !glob.compare( "coord" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read coord node information";
|
ostr << " * [INFO] could not read coord node information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -377,7 +371,7 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -390,52 +384,49 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
SGNODE* WRL2POINTSET::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2POINTSET::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
// note: there are no plans to support drawing of points
|
// note: there are no plans to support drawing of points
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2POINTSET::unlinkChildNode( const WRL2NODE* aNode )
|
void WRL2POINTSET::unlinkChildNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() == this )
|
if( aNode->GetParent() == this )
|
||||||
{
|
{
|
||||||
if( aNode == color )
|
if( aNode == color )
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
else if( aNode == coord )
|
else if( aNode == coord )
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkChildNode( aNode );
|
WRL2NODE::unlinkChildNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2POINTSET::unlinkRefNode( const WRL2NODE* aNode )
|
void WRL2POINTSET::unlinkRefNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode->GetParent() != this )
|
if( aNode->GetParent() != this )
|
||||||
{
|
{
|
||||||
if( aNode == color )
|
if( aNode == color )
|
||||||
color = NULL;
|
color = nullptr;
|
||||||
else if( aNode == coord )
|
else if( aNode == coord )
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE::unlinkRefNode( aNode );
|
WRL2NODE::unlinkRefNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool WRL2POINTSET::HasColors( void )
|
bool WRL2POINTSET::HasColors( void )
|
||||||
{
|
{
|
||||||
if( NULL == color )
|
if( nullptr == color )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((WRL2COLOR*) color)->HasColors();
|
return ( (WRL2COLOR*) color )->HasColors();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -34,30 +35,27 @@
|
||||||
|
|
||||||
WRL2SHAPE::WRL2SHAPE() : WRL2NODE()
|
WRL2SHAPE::WRL2SHAPE() : WRL2NODE()
|
||||||
{
|
{
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_SHAPE;
|
m_Type = WRL2NODES::WRL2_SHAPE;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2SHAPE::WRL2SHAPE( WRL2NODE* aParent ) : WRL2NODE()
|
WRL2SHAPE::WRL2SHAPE( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
{
|
{
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
m_Type = WRL2NODES::WRL2_SHAPE;
|
m_Type = WRL2NODES::WRL2_SHAPE;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2SHAPE::~WRL2SHAPE()
|
WRL2SHAPE::~WRL2SHAPE()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Shape with " << m_Children.size();
|
ostr << " * [INFO] Destroying Shape with " << m_Children.size();
|
||||||
|
@ -65,9 +63,7 @@ WRL2SHAPE::~WRL2SHAPE()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +73,7 @@ bool WRL2SHAPE::isDangling( void )
|
||||||
// WRL2_TRANSFORM
|
// WRL2_TRANSFORM
|
||||||
// WRL2_SWITCH
|
// WRL2_SWITCH
|
||||||
|
|
||||||
if( NULL == m_Parent
|
if( nullptr == m_Parent
|
||||||
|| ( m_Parent->GetNodeType() != WRL2NODES::WRL2_TRANSFORM
|
|| ( m_Parent->GetNodeType() != WRL2NODES::WRL2_TRANSFORM
|
||||||
&& m_Parent->GetNodeType() != WRL2NODES::WRL2_SWITCH ) )
|
&& m_Parent->GetNodeType() != WRL2NODES::WRL2_SWITCH ) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -88,16 +84,16 @@ bool WRL2SHAPE::isDangling( void )
|
||||||
|
|
||||||
bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +102,7 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -114,23 +110,23 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_APPEARANCE == type )
|
if( WRL2NODES::WRL2_APPEARANCE == type )
|
||||||
{
|
{
|
||||||
if( NULL != appearance )
|
if( nullptr != appearance )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple appearance nodes";
|
ostr << " * [INFO] bad file format; multiple appearance nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -139,16 +135,16 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
||||||
return WRL2NODE::AddRefNode( aNode );
|
return WRL2NODE::AddRefNode( aNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != geometry )
|
if( nullptr != geometry )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple geometry nodes";
|
ostr << " * [INFO] bad file format; multiple geometry nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -160,16 +156,16 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed for aNode";
|
ostr << " * [BUG] NULL passed for aNode";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +174,7 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
||||||
|
|
||||||
if( !checkNodeType( type ) )
|
if( !checkNodeType( type ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -186,23 +182,23 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
||||||
ostr << aNode->GetNodeTypeName( type ) << "'";
|
ostr << aNode->GetNodeTypeName( type ) << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WRL2NODES::WRL2_APPEARANCE == type )
|
if( WRL2NODES::WRL2_APPEARANCE == type )
|
||||||
{
|
{
|
||||||
if( NULL != appearance )
|
if( nullptr != appearance )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple appearance nodes";
|
ostr << " * [INFO] bad file format; multiple appearance nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -211,16 +207,16 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
||||||
return WRL2NODE::AddChildNode( aNode );
|
return WRL2NODE::AddChildNode( aNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != geometry )
|
if( nullptr != geometry )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] bad file format; multiple geometry nodes";
|
ostr << " * [INFO] bad file format; multiple geometry nodes";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -258,16 +254,16 @@ bool WRL2SHAPE::checkNodeType( WRL2NODES aType )
|
||||||
|
|
||||||
bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +275,7 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -287,14 +283,14 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -303,7 +299,7 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -321,14 +317,14 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -341,39 +337,39 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !glob.compare( "appearance" ) )
|
if( !glob.compare( "appearance" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read appearance information";
|
ostr << " * [INFO] could not read appearance information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !glob.compare( "geometry" ) )
|
else if( !glob.compare( "geometry" ) )
|
||||||
{
|
{
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] could not read geometry information";
|
ostr << " * [INFO] could not read geometry information";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -382,7 +378,7 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -394,8 +390,8 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == geometry )
|
if( nullptr == geometry )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
WRL2NODES geomType = geometry->GetNodeType();
|
WRL2NODES geomType = geometry->GetNodeType();
|
||||||
|
|
||||||
|
@ -404,14 +400,14 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
case WRL2NODES::WRL2_INDEXEDLINESET:
|
case WRL2NODES::WRL2_INDEXEDLINESET:
|
||||||
case WRL2NODES::WRL2_POINTSET:
|
case WRL2NODES::WRL2_POINTSET:
|
||||||
case WRL2NODES::WRL2_TEXT:
|
case WRL2NODES::WRL2_TEXT:
|
||||||
return NULL;
|
return nullptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Shape with " << m_Children.size();
|
ostr << " * [INFO] Translating Shape with " << m_Children.size();
|
||||||
|
@ -419,7 +415,7 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool vcolors = false;
|
bool vcolors = false;
|
||||||
|
|
||||||
|
@ -427,20 +423,20 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
vcolors = ((WRL2FACESET*)geometry)->HasColors();
|
vcolors = ((WRL2FACESET*)geometry)->HasColors();
|
||||||
|
|
||||||
// if there is no appearance, make use of the per vertex colors if available
|
// if there is no appearance, make use of the per vertex colors if available
|
||||||
if( NULL == appearance )
|
if( nullptr == appearance )
|
||||||
{
|
{
|
||||||
if( WRL2NODES::WRL2_INDEXEDFACESET != geometry->GetNodeType() )
|
if( WRL2NODES::WRL2_INDEXEDFACESET != geometry->GetNodeType() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( !vcolors )
|
if( !vcolors )
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -448,24 +444,24 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,26 +473,26 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
SGNODE* pShape = shNode.GetRawPtr();
|
SGNODE* pShape = shNode.GetRawPtr();
|
||||||
SGNODE* pGeom = geometry->TranslateToSG( pShape );
|
SGNODE* pGeom = geometry->TranslateToSG( pShape );
|
||||||
|
|
||||||
if( NULL == pGeom )
|
if( nullptr == pGeom )
|
||||||
{
|
{
|
||||||
// this can happen if a VRML file contains
|
// this can happen if a VRML file contains
|
||||||
// empty point or index sets
|
// empty point or index sets
|
||||||
shNode.Destroy();
|
shNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGNODE* pApp = NULL;
|
SGNODE* pApp = nullptr;
|
||||||
|
|
||||||
if( NULL != appearance )
|
if( nullptr != appearance )
|
||||||
pApp = appearance->TranslateToSG( pShape );
|
pApp = appearance->TranslateToSG( pShape );
|
||||||
|
|
||||||
if( NULL != appearance && NULL == pApp )
|
if( nullptr != appearance && nullptr == pApp )
|
||||||
{
|
{
|
||||||
IFSG_FACESET tmp( false );
|
IFSG_FACESET tmp( false );
|
||||||
tmp.Attach( pGeom );
|
tmp.Attach( pGeom );
|
||||||
tmp.Destroy();
|
tmp.Destroy();
|
||||||
shNode.Destroy();
|
shNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sgNode = shNode.GetRawPtr();
|
m_sgNode = shNode.GetRawPtr();
|
||||||
|
@ -507,29 +503,27 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
void WRL2SHAPE::unlinkChildNode( const WRL2NODE* aNode )
|
void WRL2SHAPE::unlinkChildNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode == appearance )
|
if( aNode == appearance )
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
else if( aNode == geometry )
|
else if( aNode == geometry )
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
|
|
||||||
WRL2NODE::unlinkChildNode( aNode );
|
WRL2NODE::unlinkChildNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WRL2SHAPE::unlinkRefNode( const WRL2NODE* aNode )
|
void WRL2SHAPE::unlinkRefNode( const WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode == appearance )
|
if( aNode == appearance )
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
else if( aNode == geometry )
|
else if( aNode == geometry )
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
|
|
||||||
WRL2NODE::unlinkRefNode( aNode );
|
WRL2NODE::unlinkRefNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -34,8 +35,6 @@ WRL2SWITCH::WRL2SWITCH() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_Type = WRL2NODES::WRL2_SWITCH;
|
m_Type = WRL2NODES::WRL2_SWITCH;
|
||||||
whichChoice = -1;
|
whichChoice = -1;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,16 +44,14 @@ WRL2SWITCH::WRL2SWITCH( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
whichChoice = -1;
|
whichChoice = -1;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2SWITCH::~WRL2SWITCH()
|
WRL2SWITCH::~WRL2SWITCH()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Switch with " << m_Children.size();
|
ostr << " * [INFO] Destroying Switch with " << m_Children.size();
|
||||||
|
@ -62,9 +59,7 @@ WRL2SWITCH::~WRL2SWITCH()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,16 +82,16 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is nullptr";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +103,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -116,14 +111,14 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -132,7 +127,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -150,14 +145,14 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +167,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFInt( whichChoice ) )
|
if( !proc.ReadSFInt( whichChoice ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -182,7 +177,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +189,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -203,7 +198,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -215,16 +210,16 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode )
|
bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed as node pointer";
|
ostr << " * [BUG] NULL passed as node pointer";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -234,12 +229,12 @@ bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
WRL2NODE* np = aNode->GetParent();
|
WRL2NODE* np = aNode->GetParent();
|
||||||
|
|
||||||
if( NULL != np )
|
if( nullptr != np )
|
||||||
aNode->SetParent( this );
|
aNode->SetParent( this );
|
||||||
|
|
||||||
if( !WRL2NODE::AddChildNode( aNode ) )
|
if( !WRL2NODE::AddChildNode( aNode ) )
|
||||||
{
|
{
|
||||||
aNode->SetParent( NULL );
|
aNode->SetParent( nullptr );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +255,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -268,12 +263,12 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODE* child = NULL;
|
WRL2NODE* child = nullptr;
|
||||||
|
|
||||||
if( '[' != tok )
|
if( '[' != tok )
|
||||||
{
|
{
|
||||||
|
@ -281,7 +276,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
if( !aTopNode->ReadNode( proc, this, &child ) )
|
if( !aTopNode->ReadNode( proc, this, &child ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( NULL != child )
|
if( nullptr != child )
|
||||||
choices.push_back( child );
|
choices.push_back( child );
|
||||||
|
|
||||||
if( proc.Peek() == ',' )
|
if( proc.Peek() == ',' )
|
||||||
|
@ -303,7 +298,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
if( !aTopNode->ReadNode( proc, this, &child ) )
|
if( !aTopNode->ReadNode( proc, this, &child ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( NULL != child )
|
if( nullptr != child )
|
||||||
choices.push_back( child );
|
choices.push_back( child );
|
||||||
|
|
||||||
if( proc.Peek() == ',' )
|
if( proc.Peek() == ',' )
|
||||||
|
@ -317,7 +312,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Switch with " << m_Children.size();
|
ostr << " * [INFO] Translating Switch with " << m_Children.size();
|
||||||
|
@ -325,22 +320,20 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( choices.empty() )
|
if( choices.empty() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Switch translation: no choices" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Switch translation: no choices\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -348,23 +341,23 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( whichChoice < 0 || whichChoice >= (int)choices.size() )
|
if( whichChoice < 0 || whichChoice >= (int)choices.size() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Switch translation: no choice (choices = ";
|
ostr << " * [INFO] Switch translation: no choice (choices = ";
|
||||||
ostr << choices.size() << "), whichChoice = " << whichChoice;
|
ostr << choices.size() << "), whichChoice = " << whichChoice;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRL2NODES type = choices[whichChoice]->GetNodeType();
|
WRL2NODES type = choices[whichChoice]->GetNodeType();
|
||||||
|
@ -378,7 +371,7 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return choices[whichChoice]->TranslateToSG( aParent );
|
return choices[whichChoice]->TranslateToSG( aParent );
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
WRL2TRANSFORM::WRL2TRANSFORM() : WRL2NODE()
|
WRL2TRANSFORM::WRL2TRANSFORM() : WRL2NODE()
|
||||||
{
|
{
|
||||||
m_Type = WRL2NODES::WRL2_TRANSFORM;
|
m_Type = WRL2NODES::WRL2_TRANSFORM;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,16 +42,14 @@ WRL2TRANSFORM::WRL2TRANSFORM( WRL2NODE* aParent ) : WRL2NODE()
|
||||||
m_Type = WRL2NODES::WRL2_TRANSFORM;
|
m_Type = WRL2NODES::WRL2_TRANSFORM;
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRL2TRANSFORM::~WRL2TRANSFORM()
|
WRL2TRANSFORM::~WRL2TRANSFORM()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Transform with " << m_Children.size();
|
ostr << " * [INFO] Destroying Transform with " << m_Children.size();
|
||||||
|
@ -59,9 +57,7 @@ WRL2TRANSFORM::~WRL2TRANSFORM()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,16 +88,16 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( NULL == aTopNode )
|
if( nullptr == aTopNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] aTopNode is NULL";
|
ostr << " * [BUG] aTopNode is NULL";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +128,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -140,14 +136,14 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( '{' != tok )
|
if( '{' != tok )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << proc.GetError() << "\n";
|
ostr << proc.GetError() << "\n";
|
||||||
|
@ -156,7 +152,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << "' at line " << line << ", column " << column;
|
ostr << "' at line " << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -174,14 +170,14 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( !proc.ReadName( glob ) )
|
if( !proc.ReadName( glob ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << proc.GetError();
|
ostr << proc.GetError();
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +196,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( center ) )
|
if( !proc.ReadSFVec3f( center ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -210,7 +206,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +220,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFRotation( rotation ) )
|
if( !proc.ReadSFRotation( rotation ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -234,7 +230,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +239,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( scale ) )
|
if( !proc.ReadSFVec3f( scale ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -253,7 +249,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +258,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFRotation( scaleOrientation ) )
|
if( !proc.ReadSFRotation( scaleOrientation ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -272,7 +268,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +277,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
{
|
{
|
||||||
if( !proc.ReadSFVec3f( translation ) )
|
if( !proc.ReadSFVec3f( translation ) )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -291,7 +287,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
ostr << " * [INFO] message: '" << proc.GetError() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +304,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -317,7 +313,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
ostr << " * [INFO] file: '" << proc.GetFileName() << "'";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -329,16 +325,16 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] NULL passed as node pointer";
|
ostr << " * [BUG] NULL passed as node pointer";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -349,13 +345,13 @@ bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
||||||
{
|
{
|
||||||
WRL2NODE* np = aNode->GetParent();
|
WRL2NODE* np = aNode->GetParent();
|
||||||
|
|
||||||
if( NULL != np )
|
if( nullptr != np )
|
||||||
aNode->SetParent( this );
|
aNode->SetParent( this );
|
||||||
|
|
||||||
|
|
||||||
if( !WRL2NODE::AddChildNode( aNode ) )
|
if( !WRL2NODE::AddChildNode( aNode ) )
|
||||||
{
|
{
|
||||||
aNode->SetParent( NULL );
|
aNode->SetParent( nullptr );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,7 +372,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
if( proc.eof() )
|
if( proc.eof() )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -384,7 +380,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
ostr << line << ", column " << column;
|
ostr << line << ", column " << column;
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +388,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
if( '[' != tok )
|
if( '[' != tok )
|
||||||
{
|
{
|
||||||
// since there are no delimiters we expect a single child
|
// since there are no delimiters we expect a single child
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( proc.Peek() == ',' )
|
if( proc.Peek() == ',' )
|
||||||
|
@ -411,7 +407,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( proc.Peek() == ',' )
|
if( proc.Peek() == ',' )
|
||||||
|
@ -425,7 +421,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||||
|
|
||||||
SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Transform with " << m_Children.size();
|
ostr << " * [INFO] Translating Transform with " << m_Children.size();
|
||||||
|
@ -433,16 +429,16 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_Children.empty() && m_Refs.empty() )
|
if( m_Children.empty() && m_Refs.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_VRML2
|
#ifdef DEBUG_VRML2
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -450,24 +446,24 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +496,7 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
case WRL2NODES::WRL2_INLINE:
|
case WRL2NODES::WRL2_INLINE:
|
||||||
case WRL2NODES::WRL2_TRANSFORM:
|
case WRL2NODES::WRL2_TRANSFORM:
|
||||||
|
|
||||||
if( NULL != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
if( nullptr != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
||||||
test = true;
|
test = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -519,14 +515,14 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
if( false == test )
|
if( false == test )
|
||||||
{
|
{
|
||||||
txNode.Destroy();
|
txNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
txNode.SetScale( SGPOINT( scale.x, scale.y, scale.z ) );
|
txNode.SetScale( SGPOINT( scale.x, scale.y, scale.z ) );
|
||||||
txNode.SetCenter( SGPOINT( center.x, center.y, center.z ) );
|
txNode.SetCenter( SGPOINT( center.x, center.y, center.z ) );
|
||||||
txNode.SetTranslation( SGPOINT( translation.x, translation.y, translation.z ) );
|
txNode.SetTranslation( SGPOINT( translation.x, translation.y, translation.z ) );
|
||||||
txNode.SetScaleOrientation( SGVECTOR( scaleOrientation.x, scaleOrientation.y,
|
txNode.SetScaleOrientation( SGVECTOR( scaleOrientation.x, scaleOrientation.y,
|
||||||
scaleOrientation.z ), scaleOrientation.w );
|
scaleOrientation.z ), scaleOrientation.w );
|
||||||
txNode.SetRotation( SGVECTOR( rotation.x, rotation.y, rotation.z), rotation.w );
|
txNode.SetRotation( SGVECTOR( rotation.x, rotation.y, rotation.z), rotation.w );
|
||||||
|
|
||||||
m_sgNode = txNode.GetRawPtr();
|
m_sgNode = txNode.GetRawPtr();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2020-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -24,11 +24,11 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* This plugin implements the legacy kicad VRML1/VRML2 and X3D parsers
|
* This plugin implements the legacy KiCad VRML1/VRML2 and X3D parsers
|
||||||
* The plugin will invoke a VRML1 or VRML2 parser depending on the
|
* The plugin will invoke a VRML1 or VRML2 parser depending on the
|
||||||
* identifying information in the file header:
|
* identifying information in the file header:
|
||||||
*
|
*
|
||||||
* #VRML V1.0 ascii
|
* #VRML V1.0 ASCII
|
||||||
* #VRML V2.0 utf8
|
* #VRML V2.0 utf8
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ const char* GetKicadPluginName( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GetPluginVersion( unsigned char* Major,
|
void GetPluginVersion( unsigned char* Major, unsigned char* Minor, unsigned char* Patch,
|
||||||
unsigned char* Minor, unsigned char* Patch, unsigned char* Revision )
|
unsigned char* Revision )
|
||||||
{
|
{
|
||||||
if( Major )
|
if( Major )
|
||||||
*Major = PLUGIN_VRML_MAJOR;
|
*Major = PLUGIN_VRML_MAJOR;
|
||||||
|
@ -111,7 +111,7 @@ int GetNExtensions( void )
|
||||||
char const* GetModelExtension( int aIndex )
|
char const* GetModelExtension( int aIndex )
|
||||||
{
|
{
|
||||||
if( aIndex < 0 || aIndex >= int( file_data.extensions.size() ) )
|
if( aIndex < 0 || aIndex >= int( file_data.extensions.size() ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return file_data.extensions[aIndex].c_str();
|
return file_data.extensions[aIndex].c_str();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ int GetNFilters( void )
|
||||||
char const* GetFileFilter( int aIndex )
|
char const* GetFileFilter( int aIndex )
|
||||||
{
|
{
|
||||||
if( aIndex < 0 || aIndex >= int( file_data.filters.size() ) )
|
if( aIndex < 0 || aIndex >= int( file_data.filters.size() ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return file_data.filters[aIndex].c_str();
|
return file_data.filters[aIndex].c_str();
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ class LOCALESWITCH
|
||||||
public:
|
public:
|
||||||
LOCALESWITCH()
|
LOCALESWITCH()
|
||||||
{
|
{
|
||||||
m_locale = setlocale( LC_NUMERIC, NULL );
|
m_locale = setlocale( LC_NUMERIC, nullptr );
|
||||||
setlocale( LC_NUMERIC, "C" );
|
setlocale( LC_NUMERIC, "C" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,8 +160,8 @@ public:
|
||||||
|
|
||||||
SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||||
{
|
{
|
||||||
FILE_LINE_READER* modelFile = NULL;
|
FILE_LINE_READER* modelFile = nullptr;
|
||||||
SCENEGRAPH* scene = NULL;
|
SCENEGRAPH* scene = nullptr;
|
||||||
wxString filename = aFileName;
|
wxString filename = aFileName;
|
||||||
wxFileName tmpfilename;
|
wxFileName tmpfilename;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||||
catch( IO_ERROR & )
|
catch( IO_ERROR & )
|
||||||
{
|
{
|
||||||
wxLogError( wxS( " * " ) + _( "[INFO] load failed: input line too long\n" ) );
|
wxLogError( wxS( " * " ) + _( "[INFO] load failed: input line too long\n" ) );
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,26 +230,26 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||||
|
|
||||||
if( proc.GetVRMLType() == WRLVERSION::VRML_V1 )
|
if( proc.GetVRMLType() == WRLVERSION::VRML_V1 )
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 1.0 file\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 1.0 file" );
|
||||||
|
|
||||||
WRL1BASE* bp = new WRL1BASE;
|
WRL1BASE* bp = new WRL1BASE;
|
||||||
|
|
||||||
if( !bp->Read( proc ) )
|
if( !bp->Read( proc ) )
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] load failed\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] load failed" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] load completed\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] load completed" );
|
||||||
|
|
||||||
scene = (SCENEGRAPH*)bp->TranslateToSG( NULL, NULL );
|
scene = (SCENEGRAPH*)bp->TranslateToSG( nullptr, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete bp;
|
delete bp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 2.0 file\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 2.0 file" );
|
||||||
|
|
||||||
WRL2BASE* bp = new WRL2BASE;
|
WRL2BASE* bp = new WRL2BASE;
|
||||||
|
|
||||||
|
@ -258,25 +258,25 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||||
|
|
||||||
if( !bp->Read( proc ) )
|
if( !bp->Read( proc ) )
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] load failed\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] load failed" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] load completed\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] load completed" );
|
||||||
|
|
||||||
// for now we recalculate all normals per-vertex per-face
|
// for now we recalculate all normals per-vertex per-face
|
||||||
scene = (SCENEGRAPH*)bp->TranslateToSG( NULL );
|
scene = (SCENEGRAPH*)bp->TranslateToSG( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete bp;
|
delete bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != modelFile )
|
if( nullptr != modelFile )
|
||||||
delete modelFile;
|
delete modelFile;
|
||||||
|
|
||||||
// DEBUG: WRITE OUT VRML2 FILE TO CONFIRM STRUCTURE
|
// DEBUG: WRITE OUT VRML2 FILE TO CONFIRM STRUCTURE
|
||||||
#if ( defined( DEBUG_VRML1 ) && DEBUG_VRML1 > 3 ) \
|
#if ( defined( DEBUG_VRML1 ) && DEBUG_VRML1 > 3 ) \
|
||||||
|| ( defined( DEBUG_VRML2 ) && DEBUG_VRML2 > 3 )
|
|| ( defined( DEBUG_VRML2 ) && DEBUG_VRML2 > 3 )
|
||||||
if( scene )
|
if( scene )
|
||||||
{
|
{
|
||||||
wxFileName fn( wxString::FromUTF8Unchecked( aFileName ) );
|
wxFileName fn( wxString::FromUTF8Unchecked( aFileName ) );
|
||||||
|
@ -291,7 +291,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||||
output.append( wxT(".wrl") );
|
output.append( wxT(".wrl") );
|
||||||
S3D::WriteVRML( output.ToUTF8(), true, (SGNODE*)(scene), true, true );
|
S3D::WriteVRML( output.ToUTF8(), true, (SGNODE*)(scene), true, true );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||||
|
|
||||||
SCENEGRAPH* LoadX3D( const wxString& aFileName )
|
SCENEGRAPH* LoadX3D( const wxString& aFileName )
|
||||||
{
|
{
|
||||||
SCENEGRAPH* scene = NULL;
|
SCENEGRAPH* scene = nullptr;
|
||||||
X3DPARSER model;
|
X3DPARSER model;
|
||||||
scene = model.Load( aFileName );
|
scene = model.Load( aFileName );
|
||||||
|
|
||||||
|
@ -309,17 +309,17 @@ SCENEGRAPH* LoadX3D( const wxString& aFileName )
|
||||||
|
|
||||||
SCENEGRAPH* Load( char const* aFileName )
|
SCENEGRAPH* Load( char const* aFileName )
|
||||||
{
|
{
|
||||||
if( NULL == aFileName )
|
if( nullptr == aFileName )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
||||||
|
|
||||||
if( !wxFileName::FileExists( fname ) )
|
if( !wxFileName::FileExists( fname ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
LOCALESWITCH switcher;
|
LOCALESWITCH switcher;
|
||||||
|
|
||||||
SCENEGRAPH* scene = NULL;
|
SCENEGRAPH* scene = nullptr;
|
||||||
wxString ext = wxFileName( fname ).GetExt();
|
wxString ext = wxFileName( fname ).GetExt();
|
||||||
|
|
||||||
if( ext == "x3d" || ext == "X3D" )
|
if( ext == "x3d" || ext == "X3D" )
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2017 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016-2017 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -123,16 +124,16 @@ static float VCalcCosAngle( const WRLVEC3F& p1, const WRLVEC3F& p2, const WRLVEC
|
||||||
// place a limit to prevent calculations from blowing up
|
// place a limit to prevent calculations from blowing up
|
||||||
if( dn < LOWER_LIMIT )
|
if( dn < LOWER_LIMIT )
|
||||||
{
|
{
|
||||||
if( (p12 + p13 - p23) < FLT_EPSILON )
|
if( ( p12 + p13 - p23 ) < FLT_EPSILON )
|
||||||
return -1.0f;
|
return -1.0f;
|
||||||
|
|
||||||
if( (p12 + p13 - p23) > FLT_EPSILON )
|
if( ( p12 + p13 - p23 ) > FLT_EPSILON )
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float cosAngle = (p12 + p13 - p23) / dn;
|
float cosAngle = ( p12 + p13 - p23 ) / dn;
|
||||||
|
|
||||||
// check the domain; errors in the cosAngle calculation
|
// check the domain; errors in the cosAngle calculation
|
||||||
// can result in domain errors
|
// can result in domain errors
|
||||||
|
@ -167,8 +168,6 @@ void FACET::Init()
|
||||||
face_normal.y = 0.0;
|
face_normal.y = 0.0;
|
||||||
face_normal.z = 0.0;
|
face_normal.z = 0.0;
|
||||||
maxIdx = 0;
|
maxIdx = 0;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,8 +199,6 @@ void FACET::AddVertex( WRLVEC3F& aVertex, int aIndex )
|
||||||
|
|
||||||
if( aIndex > maxIdx )
|
if( aIndex > maxIdx )
|
||||||
maxIdx = aIndex;
|
maxIdx = aIndex;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -386,8 +383,8 @@ void FACET::CalcVertexNormal( int aIndex, std::list< FACET* > &aFacetList, float
|
||||||
|
|
||||||
// normalize the vector
|
// normalize the vector
|
||||||
float dn = sqrtf( norms[idx].x * norms[idx].x
|
float dn = sqrtf( norms[idx].x * norms[idx].x
|
||||||
+ norms[idx].y * norms[idx].y
|
+ norms[idx].y * norms[idx].y
|
||||||
+ norms[idx].z * norms[idx].z );
|
+ norms[idx].z * norms[idx].z );
|
||||||
|
|
||||||
if( dn > LOWER_LIMIT )
|
if( dn > LOWER_LIMIT )
|
||||||
{
|
{
|
||||||
|
@ -410,8 +407,6 @@ void FACET::CalcVertexNormal( int aIndex, std::list< FACET* > &aFacetList, float
|
||||||
++idx;
|
++idx;
|
||||||
++sI;
|
++sI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,7 +461,7 @@ bool FACET::GetFaceNormal( WRLVEC3F& aNorm )
|
||||||
|
|
||||||
|
|
||||||
bool FACET::GetData( std::vector< WRLVEC3F >& aVertexList, std::vector< WRLVEC3F >& aNormalsList,
|
bool FACET::GetData( std::vector< WRLVEC3F >& aVertexList, std::vector< WRLVEC3F >& aNormalsList,
|
||||||
std::vector< SGCOLOR >& aColorsList, WRL1_ORDER aVertexOrder )
|
std::vector< SGCOLOR >& aColorsList, WRL1_ORDER aVertexOrder )
|
||||||
{
|
{
|
||||||
// if no normals are calculated we simply return
|
// if no normals are calculated we simply return
|
||||||
if( norms.empty() )
|
if( norms.empty() )
|
||||||
|
@ -663,8 +658,6 @@ void FACET::CollectVertices( std::vector< std::list< FACET* > >& aFacetList )
|
||||||
aFacetList[*sI].push_back( this );
|
aFacetList[*sI].push_back( this );
|
||||||
++sI;
|
++sI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -681,8 +674,6 @@ void FACET::Renormalize( float aMaxValue )
|
||||||
vnweight[i].y /= aMaxValue;
|
vnweight[i].y /= aMaxValue;
|
||||||
vnweight[i].z /= aMaxValue;
|
vnweight[i].z /= aMaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -711,10 +702,10 @@ FACET* SHAPE::NewFacet()
|
||||||
|
|
||||||
|
|
||||||
SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrder,
|
SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrder,
|
||||||
float aCreaseLimit, bool isVRML2 )
|
float aCreaseLimit, bool isVRML2 )
|
||||||
{
|
{
|
||||||
if( facets.empty() || !facets.front()->HasMinPoints() )
|
if( facets.empty() || !facets.front()->HasMinPoints() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
std::vector< std::list< FACET* > > flist;
|
std::vector< std::list< FACET* > > flist;
|
||||||
|
|
||||||
|
@ -744,7 +735,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
||||||
++maxIdx;
|
++maxIdx;
|
||||||
|
|
||||||
if( maxIdx < 3 )
|
if( maxIdx < 3 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
flist.resize( maxIdx );
|
flist.resize( maxIdx );
|
||||||
|
|
||||||
|
@ -790,7 +781,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
||||||
flist.clear();
|
flist.clear();
|
||||||
|
|
||||||
if( vertices.size() < 3 )
|
if( vertices.size() < 3 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
IFSG_SHAPE shapeNode( false );
|
IFSG_SHAPE shapeNode( false );
|
||||||
|
|
||||||
|
@ -800,7 +791,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
||||||
|
|
||||||
if( aColor )
|
if( aColor )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( aColor ) )
|
if( nullptr == S3D::GetSGNodeParent( aColor ) )
|
||||||
shapeNode.AddChildNode( aColor );
|
shapeNode.AddChildNode( aColor );
|
||||||
else
|
else
|
||||||
shapeNode.AddRefNode( aColor );
|
shapeNode.AddRefNode( aColor );
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -28,22 +29,31 @@
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include "wrlproc.h"
|
#include "wrlproc.h"
|
||||||
|
|
||||||
#define GETLINE do {\
|
#define GETLINE \
|
||||||
try { \
|
do \
|
||||||
char* cp = m_file->ReadLine(); \
|
{ \
|
||||||
if( NULL == cp ) { \
|
try \
|
||||||
m_eof = true; \
|
{ \
|
||||||
m_buf.clear(); \
|
char* cp = m_file->ReadLine(); \
|
||||||
} else { \
|
if( nullptr == cp ) \
|
||||||
m_buf = cp; \
|
{ \
|
||||||
m_bufpos = 0; \
|
m_eof = true; \
|
||||||
} \
|
m_buf.clear(); \
|
||||||
m_fileline = m_file->LineNumber(); \
|
} \
|
||||||
} catch( ... ) { \
|
else \
|
||||||
m_error = " * [INFO] input line too long"; \
|
{ \
|
||||||
m_eof = true; \
|
m_buf = cp; \
|
||||||
m_buf.clear(); \
|
m_bufpos = 0; \
|
||||||
} } while( 0 )
|
} \
|
||||||
|
m_fileline = m_file->LineNumber(); \
|
||||||
|
} \
|
||||||
|
catch( ... ) \
|
||||||
|
{ \
|
||||||
|
m_error = " * [INFO] input line too long"; \
|
||||||
|
m_eof = true; \
|
||||||
|
m_buf.clear(); \
|
||||||
|
} \
|
||||||
|
} while( 0 )
|
||||||
|
|
||||||
|
|
||||||
WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
||||||
|
@ -54,7 +64,7 @@ WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
||||||
m_bufpos = 0;
|
m_bufpos = 0;
|
||||||
m_file = aLineReader;
|
m_file = aLineReader;
|
||||||
|
|
||||||
if( NULL == aLineReader )
|
if( nullptr == aLineReader )
|
||||||
{
|
{
|
||||||
m_eof = true;
|
m_eof = true;
|
||||||
return;
|
return;
|
||||||
|
@ -119,14 +129,11 @@ WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
||||||
m_error.append( m_filename );
|
m_error.append( m_filename );
|
||||||
m_error.append( 1, '\'' );
|
m_error.append( 1, '\'' );
|
||||||
m_badchars.clear();
|
m_badchars.clear();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRLPROC::~WRLPROC()
|
WRLPROC::~WRLPROC()
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +234,7 @@ WRLVERSION WRLPROC::GetVRMLType( void )
|
||||||
const char* WRLPROC::GetParentDir( void )
|
const char* WRLPROC::GetParentDir( void )
|
||||||
{
|
{
|
||||||
if( m_filedir.empty() )
|
if( m_filedir.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return m_filedir.c_str();
|
return m_filedir.c_str();
|
||||||
}
|
}
|
||||||
|
@ -620,7 +627,8 @@ bool WRLPROC::ReadString( std::string& aSFString )
|
||||||
if( !EatSpace() )
|
if( !EatSpace() )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << "invalid VRML file; expecting string at line " << ifline << " but found nothing";
|
ostr << "invalid VRML file; expecting string at line " << ifline <<
|
||||||
|
" but found nothing";
|
||||||
m_error = ostr.str();
|
m_error = ostr.str();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -677,7 +685,6 @@ bool WRLPROC::ReadString( std::string& aSFString )
|
||||||
m_error = ostr.str();
|
m_error = ostr.str();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,13 +737,21 @@ bool WRLPROC::ReadSFBool( bool& aSFBool )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !tmp.compare( "0" ) )
|
if( !tmp.compare( "0" ) )
|
||||||
|
{
|
||||||
aSFBool = false;
|
aSFBool = false;
|
||||||
|
}
|
||||||
else if( !tmp.compare( "1" ) )
|
else if( !tmp.compare( "1" ) )
|
||||||
|
{
|
||||||
aSFBool = true;
|
aSFBool = true;
|
||||||
|
}
|
||||||
else if( !tmp.compare( "TRUE" ) )
|
else if( !tmp.compare( "TRUE" ) )
|
||||||
|
{
|
||||||
aSFBool = true;
|
aSFBool = true;
|
||||||
|
}
|
||||||
else if( !tmp.compare( "FALSE" ) )
|
else if( !tmp.compare( "FALSE" ) )
|
||||||
|
{
|
||||||
aSFBool = false;
|
aSFBool = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -1477,7 +1492,6 @@ bool WRLPROC::ReadMFFloat( std::vector< float >& aMFFloat )
|
||||||
|
|
||||||
if( ',' == m_buf[m_bufpos] )
|
if( ',' == m_buf[m_bufpos] )
|
||||||
Pop();
|
Pop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_bufpos;
|
++m_bufpos;
|
||||||
|
@ -1813,7 +1827,6 @@ bool WRLPROC::ReadMFVec2f( std::vector< WRLVEC2F >& aMFVec2f )
|
||||||
|
|
||||||
if( ',' == m_buf[m_bufpos] )
|
if( ',' == m_buf[m_bufpos] )
|
||||||
Pop();
|
Pop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_bufpos;
|
++m_bufpos;
|
||||||
|
@ -2008,6 +2021,4 @@ void WRLPROC::Pop( void )
|
||||||
{
|
{
|
||||||
if( m_bufpos < m_buf.size() )
|
if( m_bufpos < m_buf.size() )
|
||||||
++m_bufpos;
|
++m_bufpos;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
|
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
|
||||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Description:
|
* Description:
|
||||||
* This plugin implements the legacy kicad X3D parser.
|
* This plugin implements the legacy KiCad X3D parser.
|
||||||
* Due to the rare use of X3D models, this plugin is a simple
|
* Due to the rare use of X3D models, this plugin is a simple
|
||||||
* reimplementation of the legacy x3dmodelparser.cpp and is not
|
* reimplementation of the legacy x3dmodelparser.cpp and is not
|
||||||
* intended to be a compliant X3D implementation.
|
* intended to be a compliant X3D implementation.
|
||||||
|
@ -49,23 +49,21 @@ SCENEGRAPH* X3DPARSER::Load( const wxString& aFileName )
|
||||||
wxXmlDocument doc;
|
wxXmlDocument doc;
|
||||||
|
|
||||||
if( !stream.IsOk() || !doc.Load( stream ) )
|
if( !stream.IsOk() || !doc.Load( stream ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
|
if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
NODE_LIST children; // VRML Grouping Nodes at top level
|
NODE_LIST children; // VRML Grouping Nodes at top level
|
||||||
|
|
||||||
if( !getGroupingNodes( doc.GetRoot(), children ) )
|
if( !getGroupingNodes( doc.GetRoot(), children ) )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
X3D_DICT dictionary; // dictionary for USE/DEF implementation
|
X3D_DICT dictionary; // dictionary for USE/DEF implementation
|
||||||
X3DNODE* topNode = new X3DTRANSFORM;
|
X3DNODE* topNode = new X3DTRANSFORM;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
for( NODE_LIST::iterator node_it = children.begin();
|
for( NODE_LIST::iterator node_it = children.begin(); node_it != children.end(); ++node_it )
|
||||||
node_it != children.end();
|
|
||||||
++node_it )
|
|
||||||
{
|
{
|
||||||
wxXmlNode* node = *node_it;
|
wxXmlNode* node = *node_it;
|
||||||
wxString name = node->GetName();
|
wxString name = node->GetName();
|
||||||
|
@ -81,10 +79,10 @@ SCENEGRAPH* X3DPARSER::Load( const wxString& aFileName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENEGRAPH* sp = NULL;
|
SCENEGRAPH* sp = nullptr;
|
||||||
|
|
||||||
if( ok )
|
if( ok )
|
||||||
sp = (SCENEGRAPH*) topNode->TranslateToSG( NULL );
|
sp = (SCENEGRAPH*) topNode->TranslateToSG( nullptr );
|
||||||
|
|
||||||
delete topNode;
|
delete topNode;
|
||||||
return sp;
|
return sp;
|
||||||
|
@ -94,11 +92,9 @@ SCENEGRAPH* X3DPARSER::Load( const wxString& aFileName )
|
||||||
bool X3DPARSER::getGroupingNodes( wxXmlNode* aNode, std::vector<wxXmlNode*>& aResult )
|
bool X3DPARSER::getGroupingNodes( wxXmlNode* aNode, std::vector<wxXmlNode*>& aResult )
|
||||||
{
|
{
|
||||||
aResult.clear();
|
aResult.clear();
|
||||||
wxXmlNode* scene = NULL;
|
wxXmlNode* scene = nullptr;
|
||||||
|
|
||||||
for( wxXmlNode* child = aNode->GetChildren();
|
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||||
child != NULL;
|
|
||||||
child = child->GetNext() )
|
|
||||||
{
|
{
|
||||||
if( child->GetName() == "Scene" )
|
if( child->GetName() == "Scene" )
|
||||||
{
|
{
|
||||||
|
@ -107,12 +103,10 @@ bool X3DPARSER::getGroupingNodes( wxXmlNode* aNode, std::vector<wxXmlNode*>& aRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == scene )
|
if( nullptr == scene )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( wxXmlNode* child = scene->GetChildren();
|
for( wxXmlNode* child = scene->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||||
child != NULL;
|
|
||||||
child = child->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& name = child->GetName();
|
const wxString& name = child->GetName();
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -45,7 +46,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Type = X3D_APPEARANCE;
|
m_Type = X3D_APPEARANCE;
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES ptype = aParent->GetNodeType();
|
X3DNODES ptype = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -62,9 +63,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
|
||||||
|
|
||||||
X3DAPP::~X3DAPP()
|
X3DAPP::~X3DAPP()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Appearance" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Appearance\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !m_MatName.empty() && m_Dict )
|
if( !m_MatName.empty() && m_Dict )
|
||||||
m_Dict->DelName( m_MatName, this );
|
m_Dict->DelName( m_MatName, this );
|
||||||
|
@ -106,9 +105,7 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -121,7 +118,7 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
||||||
{
|
{
|
||||||
X3DNODE* np = m_Dict->FindName( prop->GetValue() );
|
X3DNODE* np = m_Dict->FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( NULL != np && np->GetNodeType() == X3D_APPEARANCE )
|
if( nullptr != np && np->GetNodeType() == X3D_APPEARANCE )
|
||||||
{
|
{
|
||||||
X3DAPP* ap = (X3DAPP*) np;
|
X3DAPP* ap = (X3DAPP*) np;
|
||||||
diffuseColor = ap->diffuseColor;
|
diffuseColor = ap->diffuseColor;
|
||||||
|
@ -133,35 +130,42 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pname == "diffuseColor" )
|
else if( pname == "diffuseColor" )
|
||||||
|
{
|
||||||
X3D::ParseSFVec3( prop->GetValue(), diffuseColor );
|
X3D::ParseSFVec3( prop->GetValue(), diffuseColor );
|
||||||
|
}
|
||||||
else if( pname == "emissiveColor" )
|
else if( pname == "emissiveColor" )
|
||||||
|
{
|
||||||
X3D::ParseSFVec3( prop->GetValue(), emissiveColor );
|
X3D::ParseSFVec3( prop->GetValue(), emissiveColor );
|
||||||
|
}
|
||||||
else if( pname == "specularColor" )
|
else if( pname == "specularColor" )
|
||||||
|
{
|
||||||
X3D::ParseSFVec3( prop->GetValue(), specularColor );
|
X3D::ParseSFVec3( prop->GetValue(), specularColor );
|
||||||
|
}
|
||||||
else if( pname == "ambientIntensity" )
|
else if( pname == "ambientIntensity" )
|
||||||
|
{
|
||||||
X3D::ParseSFFloat( prop->GetValue(), ambientIntensity );
|
X3D::ParseSFFloat( prop->GetValue(), ambientIntensity );
|
||||||
|
}
|
||||||
else if( pname == "shininess" )
|
else if( pname == "shininess" )
|
||||||
|
{
|
||||||
X3D::ParseSFFloat( prop->GetValue(), shininess );
|
X3D::ParseSFFloat( prop->GetValue(), shininess );
|
||||||
|
}
|
||||||
else if( pname == "transparency" )
|
else if( pname == "transparency" )
|
||||||
|
{
|
||||||
X3D::ParseSFFloat( prop->GetValue(), transparency );
|
X3D::ParseSFFloat( prop->GetValue(), transparency );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool X3DAPP::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
bool X3DAPP::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode || NULL == aNode )
|
if( nullptr == aTopNode || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Dict = &aDict;
|
m_Dict = &aDict;
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -172,18 +176,16 @@ bool X3DAPP::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxXmlNode* pmat = NULL;
|
wxXmlNode* pmat = nullptr;
|
||||||
|
|
||||||
for( wxXmlNode* child = aNode->GetChildren();
|
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||||
child != NULL;
|
|
||||||
child = child->GetNext() )
|
|
||||||
{
|
{
|
||||||
if( child->GetName() == "Material" )
|
if( child->GetName() == "Material" )
|
||||||
pmat = child;
|
pmat = child;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == pmat )
|
if( nullptr == pmat )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
readFields( pmat );
|
readFields( pmat );
|
||||||
|
@ -200,7 +202,7 @@ bool X3DAPP::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES nt = aParent->GetNodeType();
|
X3DNODES nt = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -208,19 +210,19 @@ bool X3DAPP::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool X3DAPP::AddChildNode( X3DNODE* aNode )
|
bool X3DAPP::AddChildNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -236,20 +238,20 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_X3D
|
#ifdef DEBUG_X3D
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] Appearance does not have a Shape parent (parent ID: ";
|
ostr << " * [BUG] Appearance does not have a Shape parent (parent ID: ";
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Appearance with " << m_Children.size();
|
ostr << " * [INFO] Translating Appearance with " << m_Children.size();
|
||||||
|
@ -257,21 +259,21 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -67,23 +68,23 @@ bool X3D_DICT::DelName( const wxString& aName, X3DNODE* aNode )
|
||||||
X3DNODE* X3D_DICT::FindName( const wxString& aName )
|
X3DNODE* X3D_DICT::FindName( const wxString& aName )
|
||||||
{
|
{
|
||||||
if( aName.empty() )
|
if( aName.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
std::map< wxString, X3DNODE* >::iterator ir = reg.find( aName );
|
std::map< wxString, X3DNODE* >::iterator ir = reg.find( aName );
|
||||||
|
|
||||||
if( ir != reg.end() )
|
if( ir != reg.end() )
|
||||||
return ir->second;
|
return ir->second;
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
X3DNODE::X3DNODE()
|
X3DNODE::X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_INVALID;
|
m_Type = X3D_INVALID;
|
||||||
m_Parent = NULL;
|
m_Parent = nullptr;
|
||||||
m_sgNode = NULL;
|
m_sgNode = nullptr;
|
||||||
m_Dict = NULL;
|
m_Dict = nullptr;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +92,7 @@ X3DNODE::X3DNODE()
|
||||||
|
|
||||||
X3DNODE::~X3DNODE()
|
X3DNODE::~X3DNODE()
|
||||||
{
|
{
|
||||||
if( !m_Name.empty() && NULL != m_Dict )
|
if( !m_Name.empty() && nullptr != m_Dict )
|
||||||
m_Dict->DelName( m_Name, this );
|
m_Dict->DelName( m_Name, this );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -172,12 +173,12 @@ void X3DNODE::delNodeRef( X3DNODE* aNode )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_X3D
|
#ifdef DEBUG_X3D
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [BUG] delNodeRef() did not find its target";
|
ostr << " * [BUG] delNodeRef() did not find its target";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,8 +34,6 @@
|
||||||
X3DCOORDS::X3DCOORDS() : X3DNODE()
|
X3DCOORDS::X3DCOORDS() : X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_COORDINATE;
|
m_Type = X3D_COORDINATE;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ X3DCOORDS::X3DCOORDS( X3DNODE* aParent ) : X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_COORDINATE;
|
m_Type = X3D_COORDINATE;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES ptype = aParent->GetNodeType();
|
X3DNODES ptype = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -50,33 +49,26 @@ X3DCOORDS::X3DCOORDS( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
X3DCOORDS::~X3DCOORDS()
|
X3DCOORDS::~X3DCOORDS()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate" );
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate\n" );
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode || NULL == aNode )
|
if( nullptr == aTopNode || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Dict = &aDict;
|
m_Dict = &aDict;
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -124,7 +116,6 @@ bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +134,7 @@ bool X3DCOORDS::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES nt = aParent->GetNodeType();
|
X3DNODES nt = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -151,12 +142,12 @@ bool X3DCOORDS::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -179,18 +170,17 @@ void X3DCOORDS::GetCoords( WRLVEC3F*& aCoordList, size_t& aListSize )
|
||||||
{
|
{
|
||||||
if( points.size() < 3 )
|
if( points.size() < 3 )
|
||||||
{
|
{
|
||||||
aCoordList = NULL;
|
aCoordList = nullptr;
|
||||||
aListSize = 0;
|
aListSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aCoordList = &points[0];
|
aCoordList = &points[0];
|
||||||
aListSize = points.size();
|
aListSize = points.size();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SGNODE* X3DCOORDS::TranslateToSG( SGNODE* aParent )
|
SGNODE* X3DCOORDS::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
X3DIFACESET::X3DIFACESET() : X3DNODE()
|
X3DIFACESET::X3DIFACESET() : X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_INDEXED_FACE_SET;
|
m_Type = X3D_INDEXED_FACE_SET;
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
init();
|
init();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -48,10 +49,10 @@ X3DIFACESET::X3DIFACESET() : X3DNODE()
|
||||||
X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
|
X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_INDEXED_FACE_SET;
|
m_Type = X3D_INDEXED_FACE_SET;
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES ptype = aParent->GetNodeType();
|
X3DNODES ptype = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -68,9 +69,9 @@ X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
|
||||||
|
|
||||||
X3DIFACESET::~X3DIFACESET()
|
X3DIFACESET::~X3DIFACESET()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying IndexedFaceSet\n" );
|
wxLogTrace( MASK_VRML, " * [INFO] Destroying IndexedFaceSet\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ X3DIFACESET::~X3DIFACESET()
|
||||||
|
|
||||||
void X3DIFACESET::init()
|
void X3DIFACESET::init()
|
||||||
{
|
{
|
||||||
coord = NULL;
|
coord = nullptr;
|
||||||
|
|
||||||
ccw = true;
|
ccw = true;
|
||||||
creaseAngle = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
creaseAngle = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
||||||
|
@ -96,9 +97,7 @@ void X3DIFACESET::readFields( wxXmlNode* aNode )
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -108,7 +107,9 @@ void X3DIFACESET::readFields( wxXmlNode* aNode )
|
||||||
m_Dict->AddName( m_Name, this );
|
m_Dict->AddName( m_Name, this );
|
||||||
}
|
}
|
||||||
else if( pname == "ccw" )
|
else if( pname == "ccw" )
|
||||||
|
{
|
||||||
X3D::ParseSFBool( prop->GetValue(), ccw );
|
X3D::ParseSFBool( prop->GetValue(), ccw );
|
||||||
|
}
|
||||||
else if( pname == "creaseAngle" )
|
else if( pname == "creaseAngle" )
|
||||||
{
|
{
|
||||||
X3D::ParseSFFloat( prop->GetValue(), creaseAngle );
|
X3D::ParseSFFloat( prop->GetValue(), creaseAngle );
|
||||||
|
@ -139,16 +140,14 @@ void X3DIFACESET::readFields( wxXmlNode* aNode )
|
||||||
|
|
||||||
bool X3DIFACESET::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
bool X3DIFACESET::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode || NULL == aNode )
|
if( nullptr == aTopNode || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Dict = &aDict;
|
m_Dict = &aDict;
|
||||||
readFields( aNode );
|
readFields( aNode );
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
for( wxXmlNode* child = aNode->GetChildren();
|
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||||
child != NULL;
|
|
||||||
child = child->GetNext() )
|
|
||||||
{
|
{
|
||||||
if( child->GetName() == "Coordinate" )
|
if( child->GetName() == "Coordinate" )
|
||||||
ok = X3D::ReadCoordinates( child, this, aDict );
|
ok = X3D::ReadCoordinates( child, this, aDict );
|
||||||
|
@ -171,7 +170,7 @@ bool X3DIFACESET::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES nt = aParent->GetNodeType();
|
X3DNODES nt = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -179,12 +178,12 @@ bool X3DIFACESET::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -193,7 +192,7 @@ bool X3DIFACESET::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
|
|
||||||
bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( aNode->GetNodeType() != X3D_COORDINATE )
|
if( aNode->GetNodeType() != X3D_COORDINATE )
|
||||||
|
@ -202,7 +201,7 @@ bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
||||||
if( aNode == coord )
|
if( aNode == coord )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Children.push_back( aNode );
|
m_Children.push_back( aNode );
|
||||||
|
@ -217,7 +216,7 @@ bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
||||||
|
|
||||||
bool X3DIFACESET::AddRefNode( X3DNODE* aNode )
|
bool X3DIFACESET::AddRefNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( aNode->GetNodeType() != X3D_COORDINATE )
|
if( aNode->GetNodeType() != X3D_COORDINATE )
|
||||||
|
@ -226,7 +225,7 @@ bool X3DIFACESET::AddRefNode( X3DNODE* aNode )
|
||||||
if( aNode == coord )
|
if( aNode == coord )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != coord )
|
if( nullptr != coord )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
|
@ -240,9 +239,9 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_X3D
|
#ifdef DEBUG_X3D
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -250,12 +249,12 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size();
|
ostr << " * [INFO] Translating IndexedFaceSet with " << m_Children.size();
|
||||||
|
@ -264,21 +263,21 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << coordIndex.size() << " coord indices";
|
ostr << coordIndex.size() << " coord indices";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,15 +286,15 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
size_t vsize = coordIndex.size();
|
size_t vsize = coordIndex.size();
|
||||||
|
|
||||||
if( NULL == coord || vsize < 3 )
|
if( nullptr == coord || vsize < 3 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
WRLVEC3F* pcoords;
|
WRLVEC3F* pcoords;
|
||||||
size_t coordsize;
|
size_t coordsize;
|
||||||
((X3DCOORDS*) coord)->GetCoords( pcoords, coordsize );
|
((X3DCOORDS*) coord)->GetCoords( pcoords, coordsize );
|
||||||
|
|
||||||
if( coordsize < 3 )
|
if( coordsize < 3 )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
// check that all indices are valid
|
// check that all indices are valid
|
||||||
for( size_t idx = 0; idx < vsize; ++idx )
|
for( size_t idx = 0; idx < vsize; ++idx )
|
||||||
|
@ -304,11 +303,11 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( coordIndex[idx] >= (int)coordsize )
|
if( coordIndex[idx] >= (int)coordsize )
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAPE lShape;
|
SHAPE lShape;
|
||||||
FACET* fp = NULL;
|
FACET* fp = nullptr;
|
||||||
size_t iCoord;
|
size_t iCoord;
|
||||||
int idx; // coordinate index
|
int idx; // coordinate index
|
||||||
|
|
||||||
|
@ -319,10 +318,10 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
if( idx < 0 )
|
if( idx < 0 )
|
||||||
{
|
{
|
||||||
if( NULL != fp )
|
if( nullptr != fp )
|
||||||
{
|
{
|
||||||
if( fp->HasMinPoints() )
|
if( fp->HasMinPoints() )
|
||||||
fp = NULL;
|
fp = nullptr;
|
||||||
else
|
else
|
||||||
fp->Init();
|
fp->Init();
|
||||||
}
|
}
|
||||||
|
@ -334,19 +333,19 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
||||||
if( idx >= (int)coordsize )
|
if( idx >= (int)coordsize )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( NULL == fp )
|
if( nullptr == fp )
|
||||||
fp = lShape.NewFacet();
|
fp = lShape.NewFacet();
|
||||||
|
|
||||||
// push the vertex value and index
|
// push the vertex value and index
|
||||||
fp->AddVertex( pcoords[idx], idx );
|
fp->AddVertex( pcoords[idx], idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
SGNODE* np = NULL;
|
SGNODE* np = nullptr;
|
||||||
|
|
||||||
if( ccw )
|
if( ccw )
|
||||||
np = lShape.CalcShape( aParent, NULL, WRL1_ORDER::ORD_CCW, creaseLimit, true );
|
np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CCW, creaseLimit, true );
|
||||||
else
|
else
|
||||||
np = lShape.CalcShape( aParent, NULL, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
||||||
|
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,14 +34,12 @@
|
||||||
bool X3D::ReadTransform( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
bool X3D::ReadTransform( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
// note: we must have a parent or else we will have a memory leak
|
// note: we must have a parent or else we will have a memory leak
|
||||||
if( NULL == aParent || NULL == aNode )
|
if( nullptr == aParent || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ bool X3D::ReadTransform( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( NULL == np )
|
if( nullptr == np )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !aParent->AddRefNode( np ) )
|
if( !aParent->AddRefNode( np ) )
|
||||||
|
@ -80,14 +79,12 @@ bool X3D::ReadSwitch( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
bool X3D::ReadShape( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
bool X3D::ReadShape( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
// note: we must have a parent or else we will have a memory leak
|
// note: we must have a parent or else we will have a memory leak
|
||||||
if( NULL == aParent || NULL == aNode )
|
if( nullptr == aParent || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -95,7 +92,7 @@ bool X3D::ReadShape( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( NULL == np )
|
if( nullptr == np )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !aParent->AddRefNode( np ) )
|
if( !aParent->AddRefNode( np ) )
|
||||||
|
@ -120,14 +117,12 @@ bool X3D::ReadShape( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
bool X3D::ReadAppearance( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
bool X3D::ReadAppearance( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
// note: we must have a parent or else we will have a memory leak
|
// note: we must have a parent or else we will have a memory leak
|
||||||
if( NULL == aParent || NULL == aNode )
|
if( nullptr == aParent || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -135,7 +130,7 @@ bool X3D::ReadAppearance( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( NULL == np )
|
if( nullptr == np )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !aParent->AddRefNode( np ) )
|
if( !aParent->AddRefNode( np ) )
|
||||||
|
@ -160,14 +155,12 @@ bool X3D::ReadAppearance( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
bool X3D::ReadIndexedFaceSet( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
bool X3D::ReadIndexedFaceSet( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
// note: we must have a parent or else we will have a memory leak
|
// note: we must have a parent or else we will have a memory leak
|
||||||
if( NULL == aParent || NULL == aNode )
|
if( nullptr == aParent || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -175,7 +168,7 @@ bool X3D::ReadIndexedFaceSet( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDic
|
||||||
{
|
{
|
||||||
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( NULL == np )
|
if( nullptr == np )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !aParent->AddRefNode( np ) )
|
if( !aParent->AddRefNode( np ) )
|
||||||
|
@ -200,14 +193,12 @@ bool X3D::ReadIndexedFaceSet( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDic
|
||||||
bool X3D::ReadCoordinates( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
bool X3D::ReadCoordinates( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
// note: we must have a parent or else we will have a memory leak
|
// note: we must have a parent or else we will have a memory leak
|
||||||
if( NULL == aParent || NULL == aNode )
|
if( nullptr == aParent || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -215,7 +206,7 @@ bool X3D::ReadCoordinates( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
X3DNODE* np = aDict.FindName( prop->GetValue() );
|
||||||
|
|
||||||
if( NULL == np )
|
if( nullptr == np )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !aParent->AddRefNode( np ) )
|
if( !aParent->AddRefNode( np ) )
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -34,20 +35,18 @@
|
||||||
X3DSHAPE::X3DSHAPE() : X3DNODE()
|
X3DSHAPE::X3DSHAPE() : X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_SHAPE;
|
m_Type = X3D_SHAPE;
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE()
|
X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE()
|
||||||
{
|
{
|
||||||
m_Type = X3D_SHAPE;
|
m_Type = X3D_SHAPE;
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES ptype = aParent->GetNodeType();
|
X3DNODES ptype = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -55,16 +54,14 @@ X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
X3DSHAPE::~X3DSHAPE()
|
X3DSHAPE::~X3DSHAPE()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Shape with " << m_Children.size();
|
ostr << " * [INFO] Destroying Shape with " << m_Children.size();
|
||||||
|
@ -72,7 +69,7 @@ X3DSHAPE::~X3DSHAPE()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,18 +77,16 @@ X3DSHAPE::~X3DSHAPE()
|
||||||
|
|
||||||
bool X3DSHAPE::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
bool X3DSHAPE::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode || NULL == aNode )
|
if( nullptr == aTopNode || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( NULL != appearance || NULL != geometry )
|
if( nullptr != appearance || nullptr != geometry )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Dict = &aDict;
|
m_Dict = &aDict;
|
||||||
wxXmlAttribute* prop;
|
wxXmlAttribute* prop;
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -102,20 +97,17 @@ bool X3DSHAPE::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( wxXmlNode* child = aNode->GetChildren();
|
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||||
child != NULL;
|
|
||||||
child = child->GetNext() )
|
|
||||||
{
|
{
|
||||||
wxString name = child->GetName();
|
wxString name = child->GetName();
|
||||||
|
|
||||||
if( name == "Appearance" && NULL == appearance )
|
if( name == "Appearance" && nullptr == appearance )
|
||||||
X3D::ReadAppearance( child, this, aDict );
|
X3D::ReadAppearance( child, this, aDict );
|
||||||
else if( name == "IndexedFaceSet" && NULL == geometry )
|
else if( name == "IndexedFaceSet" && nullptr == geometry )
|
||||||
X3D::ReadIndexedFaceSet( child, this, aDict );
|
X3D::ReadIndexedFaceSet( child, this, aDict );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == appearance || NULL == geometry )
|
if( nullptr == appearance || nullptr == geometry )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !SetParent( aTopNode ) )
|
if( !SetParent( aTopNode ) )
|
||||||
|
@ -130,7 +122,7 @@ bool X3DSHAPE::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES nt = aParent->GetNodeType();
|
X3DNODES nt = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -138,12 +130,12 @@ bool X3DSHAPE::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -152,7 +144,7 @@ bool X3DSHAPE::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
|
|
||||||
bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
X3DNODES tchild = aNode->GetNodeType();
|
X3DNODES tchild = aNode->GetNodeType();
|
||||||
|
@ -173,23 +165,27 @@ bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
||||||
|
|
||||||
if( X3D_APPEARANCE == tchild )
|
if( X3D_APPEARANCE == tchild )
|
||||||
{
|
{
|
||||||
if( NULL == appearance )
|
if( nullptr == appearance )
|
||||||
{
|
{
|
||||||
m_Children.push_back( aNode );
|
m_Children.push_back( aNode );
|
||||||
appearance = aNode;
|
appearance = aNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( NULL == geometry )
|
if( nullptr == geometry )
|
||||||
{
|
{
|
||||||
m_Children.push_back( aNode );
|
m_Children.push_back( aNode );
|
||||||
geometry = aNode;
|
geometry = aNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aNode->GetParent() != this )
|
if( aNode->GetParent() != this )
|
||||||
|
@ -201,7 +197,7 @@ bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
||||||
|
|
||||||
bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
X3DNODES tchild = aNode->GetNodeType();
|
X3DNODES tchild = aNode->GetNodeType();
|
||||||
|
@ -222,25 +218,29 @@ bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
||||||
|
|
||||||
if( X3D_APPEARANCE == tchild )
|
if( X3D_APPEARANCE == tchild )
|
||||||
{
|
{
|
||||||
if( NULL == appearance )
|
if( nullptr == appearance )
|
||||||
{
|
{
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
aNode->addNodeRef( this );
|
aNode->addNodeRef( this );
|
||||||
appearance = aNode;
|
appearance = aNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( NULL == geometry )
|
if( nullptr == geometry )
|
||||||
{
|
{
|
||||||
m_Refs.push_back( aNode );
|
m_Refs.push_back( aNode );
|
||||||
aNode->addNodeRef( this );
|
aNode->addNodeRef( this );
|
||||||
geometry = aNode;
|
geometry = aNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -249,10 +249,10 @@ bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
||||||
|
|
||||||
SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
if( NULL == geometry || NULL == appearance )
|
if( nullptr == geometry || nullptr == appearance )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Shape with " << m_Children.size();
|
ostr << " * [INFO] Translating Shape with " << m_Children.size();
|
||||||
|
@ -260,13 +260,13 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_X3D
|
#ifdef DEBUG_X3D
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -274,24 +274,24 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
SGNODE* pGeom = geometry->TranslateToSG( pShape );
|
SGNODE* pGeom = geometry->TranslateToSG( pShape );
|
||||||
SGNODE* pApp = appearance->TranslateToSG( pShape );
|
SGNODE* pApp = appearance->TranslateToSG( pShape );
|
||||||
|
|
||||||
if( NULL == pApp || NULL == pGeom )
|
if( nullptr == pApp || nullptr == pGeom )
|
||||||
{
|
{
|
||||||
if( pGeom )
|
if( pGeom )
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
shNode.Destroy();
|
shNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sgNode = shNode.GetRawPtr();
|
m_sgNode = shNode.GetRawPtr();
|
||||||
|
@ -332,29 +332,27 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||||
|
|
||||||
void X3DSHAPE::unlinkChildNode( const X3DNODE* aNode )
|
void X3DSHAPE::unlinkChildNode( const X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode == appearance )
|
if( aNode == appearance )
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
else if( aNode == geometry )
|
else if( aNode == geometry )
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
|
|
||||||
X3DNODE::unlinkChildNode( aNode );
|
X3DNODE::unlinkChildNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void X3DSHAPE::unlinkRefNode( const X3DNODE* aNode )
|
void X3DSHAPE::unlinkRefNode( const X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( aNode == appearance )
|
if( aNode == appearance )
|
||||||
appearance = NULL;
|
appearance = nullptr;
|
||||||
else if( aNode == geometry )
|
else if( aNode == geometry )
|
||||||
geometry = NULL;
|
geometry = nullptr;
|
||||||
|
|
||||||
X3DNODE::unlinkRefNode( aNode );
|
X3DNODE::unlinkRefNode( aNode );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -44,7 +45,7 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Type = X3D_TRANSFORM;
|
m_Type = X3D_TRANSFORM;
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES ptype = aParent->GetNodeType();
|
X3DNODES ptype = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE()
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -61,7 +62,7 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE()
|
||||||
|
|
||||||
X3DTRANSFORM::~X3DTRANSFORM()
|
X3DTRANSFORM::~X3DTRANSFORM()
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Destroying Transform with " << m_Children.size();
|
ostr << " * [INFO] Destroying Transform with " << m_Children.size();
|
||||||
|
@ -69,7 +70,7 @@ X3DTRANSFORM::~X3DTRANSFORM()
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -117,9 +118,7 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode )
|
||||||
// legacy behavior of 1 X3D unit = 0.1 inch; the SG*
|
// legacy behavior of 1 X3D unit = 0.1 inch; the SG*
|
||||||
// classes expect all units in mm.
|
// classes expect all units in mm.
|
||||||
|
|
||||||
for( prop = aNode->GetAttributes();
|
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||||
prop != NULL;
|
|
||||||
prop = prop->GetNext() )
|
|
||||||
{
|
{
|
||||||
const wxString& pname = prop->GetName();
|
const wxString& pname = prop->GetName();
|
||||||
|
|
||||||
|
@ -134,35 +133,36 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode )
|
||||||
center *= 2.54;
|
center *= 2.54;
|
||||||
}
|
}
|
||||||
else if( pname == "scale" )
|
else if( pname == "scale" )
|
||||||
|
{
|
||||||
X3D::ParseSFVec3( prop->GetValue(), scale );
|
X3D::ParseSFVec3( prop->GetValue(), scale );
|
||||||
|
}
|
||||||
else if( pname == "translation" )
|
else if( pname == "translation" )
|
||||||
{
|
{
|
||||||
X3D::ParseSFVec3( prop->GetValue(), translation );
|
X3D::ParseSFVec3( prop->GetValue(), translation );
|
||||||
translation *= 2.54;
|
translation *= 2.54;
|
||||||
}
|
}
|
||||||
else if( pname == "rotation" )
|
else if( pname == "rotation" )
|
||||||
|
{
|
||||||
X3D::ParseSFRotation( prop->GetValue(), rotation );
|
X3D::ParseSFRotation( prop->GetValue(), rotation );
|
||||||
|
}
|
||||||
else if( pname == "scaleOrientation" )
|
else if( pname == "scaleOrientation" )
|
||||||
|
{
|
||||||
X3D::ParseSFRotation( prop->GetValue(), scaleOrientation );
|
X3D::ParseSFRotation( prop->GetValue(), scaleOrientation );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool X3DTRANSFORM::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
bool X3DTRANSFORM::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||||
{
|
{
|
||||||
if( NULL == aTopNode || NULL == aNode )
|
if( nullptr == aTopNode || nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_Dict = &aDict;
|
m_Dict = &aDict;
|
||||||
readFields( aNode );
|
readFields( aNode );
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
for( wxXmlNode* child = aNode->GetChildren();
|
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||||
child != NULL;
|
|
||||||
child = child->GetNext() )
|
|
||||||
{
|
{
|
||||||
wxString name = child->GetName();
|
wxString name = child->GetName();
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ bool X3DTRANSFORM::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
if( aParent == m_Parent )
|
if( aParent == m_Parent )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
X3DNODES nt = aParent->GetNodeType();
|
X3DNODES nt = aParent->GetNodeType();
|
||||||
|
|
||||||
|
@ -198,12 +198,12 @@ bool X3DTRANSFORM::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL != m_Parent && doUnlink )
|
if( nullptr != m_Parent && doUnlink )
|
||||||
m_Parent->unlinkChildNode( this );
|
m_Parent->unlinkChildNode( this );
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
|
|
||||||
if( NULL != m_Parent )
|
if( nullptr != m_Parent )
|
||||||
m_Parent->AddChildNode( this );
|
m_Parent->AddChildNode( this );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -212,7 +212,7 @@ bool X3DTRANSFORM::SetParent( X3DNODE* aParent, bool doUnlink )
|
||||||
|
|
||||||
bool X3DTRANSFORM::AddChildNode( X3DNODE* aNode )
|
bool X3DTRANSFORM::AddChildNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
X3DNODES tchild = aNode->GetNodeType();
|
X3DNODES tchild = aNode->GetNodeType();
|
||||||
|
@ -242,7 +242,7 @@ bool X3DTRANSFORM::AddChildNode( X3DNODE* aNode )
|
||||||
|
|
||||||
bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode )
|
bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode )
|
||||||
{
|
{
|
||||||
if( NULL == aNode )
|
if( nullptr == aNode )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
X3DNODES tchild = aNode->GetNodeType();
|
X3DNODES tchild = aNode->GetNodeType();
|
||||||
|
@ -270,7 +270,7 @@ bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode )
|
||||||
|
|
||||||
SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
{
|
{
|
||||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << " * [INFO] Translating Transform with " << m_Children.size();
|
ostr << " * [INFO] Translating Transform with " << m_Children.size();
|
||||||
|
@ -278,16 +278,16 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << m_BackPointers.size() << " backpointers";
|
ostr << m_BackPointers.size() << " backpointers";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_Children.empty() && m_Refs.empty() )
|
if( m_Children.empty() && m_Refs.empty() )
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||||
|
|
||||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_X3D
|
#ifdef DEBUG_X3D
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
@ -295,24 +295,24 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
ostr << ptype << ")";
|
ostr << ptype << ")";
|
||||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_sgNode )
|
if( m_sgNode )
|
||||||
{
|
{
|
||||||
if( NULL != aParent )
|
if( nullptr != aParent )
|
||||||
{
|
{
|
||||||
if( NULL == S3D::GetSGNodeParent( m_sgNode )
|
if( nullptr == S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeChild( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
case X3D_SWITCH:
|
case X3D_SWITCH:
|
||||||
case X3D_TRANSFORM:
|
case X3D_TRANSFORM:
|
||||||
|
|
||||||
if( NULL != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
if( nullptr != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
||||||
test = true;
|
test = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -363,7 +363,7 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
if( false == test )
|
if( false == test )
|
||||||
{
|
{
|
||||||
txNode.Destroy();
|
txNode.Destroy();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
txNode.SetScale( SGPOINT( scale.x, scale.y, scale.z ) );
|
txNode.SetScale( SGPOINT( scale.x, scale.y, scale.z ) );
|
||||||
|
@ -371,7 +371,7 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
||||||
txNode.SetTranslation( SGPOINT( translation.x, translation.y, translation.z ) );
|
txNode.SetTranslation( SGPOINT( translation.x, translation.y, translation.z ) );
|
||||||
txNode.SetScaleOrientation( SGVECTOR( scaleOrientation.x, scaleOrientation.y,
|
txNode.SetScaleOrientation( SGVECTOR( scaleOrientation.x, scaleOrientation.y,
|
||||||
scaleOrientation.z ), scaleOrientation.w );
|
scaleOrientation.z ), scaleOrientation.w );
|
||||||
txNode.SetRotation( SGVECTOR( rotation.x, rotation.y, rotation.z), rotation.w );
|
txNode.SetRotation( SGVECTOR( rotation.x, rotation.y, rotation.z ), rotation.w );
|
||||||
|
|
||||||
m_sgNode = txNode.GetRawPtr();
|
m_sgNode = txNode.GetRawPtr();
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -38,12 +39,12 @@
|
||||||
KICAD_PLUGIN_LDR_3D::KICAD_PLUGIN_LDR_3D()
|
KICAD_PLUGIN_LDR_3D::KICAD_PLUGIN_LDR_3D()
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
m_getNExtensions = NULL;
|
m_getNExtensions = nullptr;
|
||||||
m_getModelExtension = NULL;
|
m_getModelExtension = nullptr;
|
||||||
m_getNFilters = NULL;
|
m_getNFilters = nullptr;
|
||||||
m_getFileFilter = NULL;
|
m_getFileFilter = nullptr;
|
||||||
m_canRender = NULL;
|
m_canRender = nullptr;
|
||||||
m_load = NULL;
|
m_load = nullptr;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -73,13 +74,13 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
||||||
m_error = ostr.str();
|
m_error = ostr.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
|
ostr << " * [INFO] failed on file " << aFullFileName.ToUTF8() << "\n";
|
||||||
ostr << " * [INFO] error: " << m_error;
|
ostr << " * [INFO] error: " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -94,128 +95,128 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
||||||
LINK_ITEM( m_canRender, PLUGIN_3D_CAN_RENDER, "CanRender" );
|
LINK_ITEM( m_canRender, PLUGIN_3D_CAN_RENDER, "CanRender" );
|
||||||
LINK_ITEM( m_load, PLUGIN_3D_LOAD, "Load" );
|
LINK_ITEM( m_load, PLUGIN_3D_LOAD, "Load" );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
|
|
||||||
if( !m_getNExtensions )
|
if( !m_getNExtensions )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "incompatible plugin (missing function 'GetNExtensions')";
|
||||||
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_getModelExtension )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetNExtensions')";
|
wxString errmsg = "incompatible plugin (missing function 'GetModelExtension')";
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( !m_getModelExtension )
|
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
wxString errmsg = "missing function 'GetModelExtension'";
|
||||||
std::ostringstream ostr;
|
ostr << errmsg.ToUTF8();
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetModelExtension')";
|
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'GetModelExtension'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_getNFilters )
|
if( !m_getNFilters )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::ostringstream ostr;
|
wxString errmsg = "incompatible plugin (missing function 'GetNFilters')";
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetNFilters')";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
fail = true;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'GetNFilters'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( !m_getFileFilter )
|
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
wxString errmsg = "missing function 'GetNFilters'";
|
||||||
std::ostringstream ostr;
|
ostr << errmsg.ToUTF8();
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetFileFilter')";
|
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'GetFileFilter'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_canRender )
|
if( !m_getFileFilter )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::ostringstream ostr;
|
wxString errmsg = "incompatible plugin (missing function 'GetFileFilter')";
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
wxString errmsg = "incompatible plugin (missing function 'CanRender')";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
fail = true;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'CanRender'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( !m_load )
|
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
wxString errmsg = "missing function 'GetFileFilter'";
|
||||||
std::ostringstream ostr;
|
ostr << errmsg.ToUTF8();
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
wxString errmsg = "incompatible plugin (missing function 'Load')";
|
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'Load'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
if( !m_canRender )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "incompatible plugin (missing function 'CanRender')";
|
||||||
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
wxString errmsg = "missing function 'CanRender'";
|
||||||
|
ostr << errmsg.ToUTF8();
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_load )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "incompatible plugin (missing function 'Load')";
|
||||||
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
wxString errmsg = "missing function 'Load'";
|
||||||
|
ostr << errmsg.ToUTF8();
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !m_getNExtensions || !m_getModelExtension || !m_getNFilters
|
if( !m_getNExtensions || !m_getModelExtension || !m_getNFilters
|
||||||
|| !m_getFileFilter || !m_canRender || !m_load )
|
|| !m_getFileFilter || !m_canRender || !m_load )
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
|
@ -233,7 +234,7 @@ bool KICAD_PLUGIN_LDR_3D::Open( const wxString& aFullFileName )
|
||||||
|
|
||||||
void KICAD_PLUGIN_LDR_3D::Close( void )
|
void KICAD_PLUGIN_LDR_3D::Close( void )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if( ok )
|
if( ok )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -241,15 +242,15 @@ void KICAD_PLUGIN_LDR_3D::Close( void )
|
||||||
ostr << " * [INFO] closing plugin";
|
ostr << " * [INFO] closing plugin";
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ok = false;
|
ok = false;
|
||||||
m_getNExtensions = NULL;
|
m_getNExtensions = nullptr;
|
||||||
m_getModelExtension = NULL;
|
m_getModelExtension = nullptr;
|
||||||
m_getNFilters = NULL;
|
m_getNFilters = nullptr;
|
||||||
m_getFileFilter = NULL;
|
m_getFileFilter = nullptr;
|
||||||
m_canRender = NULL;
|
m_canRender = nullptr;
|
||||||
m_load = NULL;
|
m_load = nullptr;
|
||||||
close();
|
close();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -257,7 +258,7 @@ void KICAD_PLUGIN_LDR_3D::Close( void )
|
||||||
|
|
||||||
|
|
||||||
void KICAD_PLUGIN_LDR_3D::GetLoaderVersion( unsigned char* Major, unsigned char* Minor,
|
void KICAD_PLUGIN_LDR_3D::GetLoaderVersion( unsigned char* Major, unsigned char* Minor,
|
||||||
unsigned char* Patch, unsigned char* Revision ) const
|
unsigned char* Patch, unsigned char* Revision ) const
|
||||||
{
|
{
|
||||||
if( Major )
|
if( Major )
|
||||||
*Major = PLUGIN_3D_MAJOR;
|
*Major = PLUGIN_3D_MAJOR;
|
||||||
|
@ -275,7 +276,6 @@ void KICAD_PLUGIN_LDR_3D::GetLoaderVersion( unsigned char* Major, unsigned char*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// these functions are shadows of the 3D Plugin functions from 3d_plugin.h
|
|
||||||
int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
|
int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
|
||||||
{
|
{
|
||||||
m_error.clear();
|
m_error.clear();
|
||||||
|
@ -288,16 +288,16 @@ int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getNExtensions )
|
if( nullptr == m_getNExtensions )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetNExtensions is not linked";
|
m_error = "[BUG] GetNExtensions is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -315,21 +315,21 @@ char const* KICAD_PLUGIN_LDR_3D::GetModelExtension( int aIndex )
|
||||||
if( m_error.empty() )
|
if( m_error.empty() )
|
||||||
m_error = "[INFO] no open plugin / plugin could not be opened";
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getModelExtension )
|
if( nullptr == m_getModelExtension )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetModelExtension is not linked";
|
m_error = "[BUG] GetModelExtension is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_getModelExtension( aIndex );
|
return m_getModelExtension( aIndex );
|
||||||
|
@ -348,16 +348,16 @@ int KICAD_PLUGIN_LDR_3D::GetNFilters( void )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getNFilters )
|
if( nullptr == m_getNFilters )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetNFilters is not linked";
|
m_error = "[BUG] GetNFilters is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -375,21 +375,21 @@ char const* KICAD_PLUGIN_LDR_3D::GetFileFilter( int aIndex )
|
||||||
if( m_error.empty() )
|
if( m_error.empty() )
|
||||||
m_error = "[INFO] no open plugin / plugin could not be opened";
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getFileFilter )
|
if( nullptr == m_getFileFilter )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetFileFilter is not linked";
|
m_error = "[BUG] GetFileFilter is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_getFileFilter( aIndex );
|
return m_getFileFilter( aIndex );
|
||||||
|
@ -408,16 +408,16 @@ bool KICAD_PLUGIN_LDR_3D::CanRender( void )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_canRender )
|
if( nullptr == m_canRender )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] CanRender is not linked";
|
m_error = "[BUG] CanRender is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -435,21 +435,21 @@ SCENEGRAPH* KICAD_PLUGIN_LDR_3D::Load( char const* aFileName )
|
||||||
if( m_error.empty() )
|
if( m_error.empty() )
|
||||||
m_error = "[INFO] no open plugin / plugin could not be opened";
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_load )
|
if( nullptr == m_load )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] Load is not linked";
|
m_error = "[BUG] Load is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_load( aFileName );
|
return m_load( aFileName );
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||||
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -34,11 +35,11 @@
|
||||||
KICAD_PLUGIN_LDR::KICAD_PLUGIN_LDR()
|
KICAD_PLUGIN_LDR::KICAD_PLUGIN_LDR()
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
m_getPluginClass = NULL;
|
m_getPluginClass = nullptr;
|
||||||
m_getClassVersion = NULL;
|
m_getClassVersion = nullptr;
|
||||||
m_checkClassVersion = NULL;
|
m_checkClassVersion = nullptr;
|
||||||
m_getPluginName = NULL;
|
m_getPluginName = nullptr;
|
||||||
m_getVersion = NULL;
|
m_getVersion = nullptr;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -67,12 +68,12 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
|
|
||||||
if( !m_PluginLoader.IsLoaded() )
|
if( !m_PluginLoader.IsLoaded() )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * could not open file: '" << aFullFileName.ToUTF8() << "'";
|
ostr << " * could not open file: '" << aFullFileName.ToUTF8() << "'";
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,104 +83,104 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
LINK_ITEM( m_getPluginName, GET_PLUGIN_NAME, "GetKicadPluginName" );
|
LINK_ITEM( m_getPluginName, GET_PLUGIN_NAME, "GetKicadPluginName" );
|
||||||
LINK_ITEM( m_getVersion, GET_VERSION, "GetPluginVersion" );
|
LINK_ITEM( m_getVersion, GET_VERSION, "GetPluginVersion" );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
|
|
||||||
if( !m_getPluginClass )
|
if( !m_getPluginClass )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "incompatible plugin (missing function 'GetKicadPluginClass')";
|
||||||
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_getClassVersion )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetKicadPluginClass')";
|
wxString errmsg = "incompatible plugin (missing function 'GetClassVersion')";
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( !m_getClassVersion )
|
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
wxString errmsg = "missing function 'GetClassVersion'";
|
||||||
std::ostringstream ostr;
|
ostr << errmsg.ToUTF8();
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetClassVersion')";
|
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'GetClassVersion'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_checkClassVersion )
|
if( !m_checkClassVersion )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::ostringstream ostr;
|
wxString errmsg = "incompatible plugin (missing function 'CheckClassVersion')";
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
wxString errmsg = "incompatible plugin (missing function 'CheckClassVersion')";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
fail = true;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'CheckClassVersion'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( !m_getPluginName )
|
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
wxString errmsg = "missing function 'CheckClassVersion'";
|
||||||
std::ostringstream ostr;
|
ostr << errmsg.ToUTF8();
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetKicadPluginName')";
|
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
fail = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'GetKicadPluginName'";
|
|
||||||
ostr << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_getVersion )
|
if( !m_getPluginName )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
{
|
{
|
||||||
if( !fail )
|
std::ostringstream ostr;
|
||||||
{
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
std::ostringstream ostr;
|
wxString errmsg = "incompatible plugin (missing function 'GetKicadPluginName')";
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
wxString errmsg = "incompatible plugin (missing function 'GetVersion')";
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
fail = true;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
wxString errmsg = "missing function 'GetVersion'";
|
|
||||||
ostr << errmsg.ToUTF8() << "\n";
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
wxString errmsg = "missing function 'GetKicadPluginName'";
|
||||||
|
ostr << errmsg.ToUTF8();
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
if( !m_getVersion )
|
||||||
|
{
|
||||||
|
if( !fail )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "incompatible plugin (missing function 'GetVersion')";
|
||||||
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
|
ostr << "'" << aFullFileName.ToUTF8() << "'";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
wxString errmsg = "missing function 'GetVersion'";
|
||||||
|
ostr << errmsg.ToUTF8() << "\n";
|
||||||
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !m_getPluginClass || !m_getClassVersion || !m_checkClassVersion
|
if( !m_getPluginClass || !m_getClassVersion || !m_checkClassVersion
|
||||||
|| !m_getPluginName || !m_getVersion )
|
|| !m_getPluginName || !m_getVersion )
|
||||||
|
@ -204,7 +205,7 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
if( pclassName )
|
if( pclassName )
|
||||||
m_error.append( pclassName );
|
m_error.append( pclassName );
|
||||||
else
|
else
|
||||||
m_error.append( "NULL" );
|
m_error.append( "nullptr" );
|
||||||
|
|
||||||
m_error.append( ")" );
|
m_error.append( ")" );
|
||||||
|
|
||||||
|
@ -252,19 +253,19 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
|
|
||||||
m_fileName = aFullFileName;
|
m_fileName = aFullFileName;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
do {
|
do {
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * [INFO] opened plugin " << m_fileName.ToUTF8();
|
ostr << " * [INFO] opened plugin " << m_fileName.ToUTF8();
|
||||||
char const* cp = m_getPluginName();
|
char const* cp = m_getPluginName();
|
||||||
|
|
||||||
if( NULL != cp )
|
if( nullptr != cp )
|
||||||
ostr << " * [INFO] plugin name: '" << cp << "'\n";
|
ostr << " * [INFO] plugin name: '" << cp << "'\n";
|
||||||
|
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
} while( 0 );
|
} while( 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
|
|
||||||
|
@ -284,11 +285,11 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
||||||
void KICAD_PLUGIN_LDR::close( void )
|
void KICAD_PLUGIN_LDR::close( void )
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
m_getPluginClass = NULL;
|
m_getPluginClass = nullptr;
|
||||||
m_getClassVersion = NULL;
|
m_getClassVersion = nullptr;
|
||||||
m_checkClassVersion = NULL;
|
m_checkClassVersion = nullptr;
|
||||||
m_getPluginName = NULL;
|
m_getPluginName = nullptr;
|
||||||
m_getVersion = NULL;
|
m_getVersion = nullptr;
|
||||||
m_PluginLoader.Unload();
|
m_PluginLoader.Unload();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -323,10 +324,10 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
|
||||||
if( m_error.empty() )
|
if( m_error.empty() )
|
||||||
m_error = "[INFO] no open plugin / plugin could not be opened";
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getPluginClass )
|
if( nullptr == m_getPluginClass )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetPluginClass is not linked";
|
m_error = "[BUG] GetPluginClass is not linked";
|
||||||
|
|
||||||
|
@ -337,7 +338,7 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_getPluginClass();
|
return m_getPluginClass();
|
||||||
|
@ -345,7 +346,7 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
|
||||||
|
|
||||||
|
|
||||||
bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Minor,
|
bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Minor,
|
||||||
unsigned char* Patch, unsigned char* Revision )
|
unsigned char* Patch, unsigned char* Revision )
|
||||||
{
|
{
|
||||||
m_error.clear();
|
m_error.clear();
|
||||||
|
|
||||||
|
@ -374,7 +375,7 @@ bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Min
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_checkClassVersion )
|
if( nullptr == m_checkClassVersion )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] CheckClassVersion is not linked";
|
m_error = "[BUG] CheckClassVersion is not linked";
|
||||||
|
|
||||||
|
@ -407,7 +408,7 @@ bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Min
|
||||||
|
|
||||||
|
|
||||||
bool KICAD_PLUGIN_LDR::CheckClassVersion( unsigned char Major, unsigned char Minor,
|
bool KICAD_PLUGIN_LDR::CheckClassVersion( unsigned char Major, unsigned char Minor,
|
||||||
unsigned char Patch, unsigned char Revision )
|
unsigned char Patch, unsigned char Revision )
|
||||||
{
|
{
|
||||||
m_error.clear();
|
m_error.clear();
|
||||||
|
|
||||||
|
@ -419,16 +420,16 @@ bool KICAD_PLUGIN_LDR::CheckClassVersion( unsigned char Major, unsigned char Min
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_checkClassVersion )
|
if( nullptr == m_checkClassVersion )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] CheckClassVersion is not linked";
|
m_error = "[BUG] CheckClassVersion is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -446,21 +447,21 @@ const char* KICAD_PLUGIN_LDR::GetKicadPluginName( void )
|
||||||
if( m_error.empty() )
|
if( m_error.empty() )
|
||||||
m_error = "[INFO] no open plugin / plugin could not be opened";
|
m_error = "[INFO] no open plugin / plugin could not be opened";
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getPluginName )
|
if( nullptr == m_getPluginName )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetKicadPluginName is not linked";
|
m_error = "[BUG] GetKicadPluginName is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_getPluginName();
|
return m_getPluginName();
|
||||||
|
@ -468,7 +469,7 @@ const char* KICAD_PLUGIN_LDR::GetKicadPluginName( void )
|
||||||
|
|
||||||
|
|
||||||
bool KICAD_PLUGIN_LDR::GetVersion( unsigned char* Major, unsigned char* Minor,
|
bool KICAD_PLUGIN_LDR::GetVersion( unsigned char* Major, unsigned char* Minor,
|
||||||
unsigned char* Patch, unsigned char* Revision )
|
unsigned char* Patch, unsigned char* Revision )
|
||||||
{
|
{
|
||||||
m_error.clear();
|
m_error.clear();
|
||||||
|
|
||||||
|
@ -480,16 +481,16 @@ bool KICAD_PLUGIN_LDR::GetVersion( unsigned char* Major, unsigned char* Minor,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NULL == m_getVersion )
|
if( nullptr == m_getVersion )
|
||||||
{
|
{
|
||||||
m_error = "[BUG] GetKicadPluginName is not linked";
|
m_error = "[BUG] GetKicadPluginName is not linked";
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
ostr << " * " << m_error;
|
ostr << " * " << m_error;
|
||||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue