More NULL expunging.
This commit is contained in:
parent
6001ac0704
commit
4c457b5ed3
|
@ -154,10 +154,10 @@ private:
|
|||
if( nextZ )
|
||||
nextZ->prevZ = prevZ;
|
||||
|
||||
next = NULL;
|
||||
prev = NULL;
|
||||
nextZ = NULL;
|
||||
prevZ = NULL;
|
||||
next = nullptr;
|
||||
prev = nullptr;
|
||||
nextZ = nullptr;
|
||||
prevZ = nullptr;
|
||||
}
|
||||
|
||||
void updateOrder()
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
virtual SHAPE* Clone() const
|
||||
{
|
||||
assert( false );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -275,7 +276,7 @@ public:
|
|||
|
||||
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()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -30,6 +30,7 @@
|
|||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_file_io.h>
|
||||
|
||||
|
||||
SHAPE_FILE_IO::SHAPE_FILE_IO()
|
||||
{
|
||||
m_groupActive = false;
|
||||
|
@ -37,6 +38,7 @@ SHAPE_FILE_IO::SHAPE_FILE_IO()
|
|||
m_file = stdout;
|
||||
}
|
||||
|
||||
|
||||
SHAPE_FILE_IO::SHAPE_FILE_IO( const std::string& aFilename, SHAPE_FILE_IO::IO_MODE aMode )
|
||||
{
|
||||
m_groupActive = false;
|
||||
|
@ -54,7 +56,7 @@ SHAPE_FILE_IO::SHAPE_FILE_IO( const std::string& aFilename, SHAPE_FILE_IO::IO_MO
|
|||
}
|
||||
else
|
||||
{
|
||||
m_file = NULL;
|
||||
m_file = nullptr;
|
||||
}
|
||||
|
||||
m_mode = aMode;
|
||||
|
@ -84,7 +86,7 @@ SHAPE* SHAPE_FILE_IO::Read()
|
|||
do {
|
||||
|
||||
if (fscanf(m_file, "%s", tmp) != 1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( !strcmp( tmp, "shape" )
|
||||
break;
|
||||
|
@ -92,7 +94,7 @@ SHAPE* SHAPE_FILE_IO::Read()
|
|||
|
||||
int type;
|
||||
|
||||
SHAPE *rv = NULL;
|
||||
SHAPE *rv = nullptr;
|
||||
|
||||
fscanf(m_file,"%d %s", &type, tmp);
|
||||
|
||||
|
@ -104,14 +106,14 @@ SHAPE* SHAPE_FILE_IO::Read()
|
|||
}
|
||||
|
||||
if(!rv)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
rv.Parse ( )
|
||||
|
||||
fprintf(m_file,"shape %d %s %s\n", aShape->Type(), aName.c_str(), sh.c_str() );
|
||||
*/
|
||||
assert( false );
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -652,7 +652,8 @@ void SHAPE_POLY_SET::booleanOp( ClipperLib::ClipType aType, const SHAPE_POLY_SET
|
|||
CLIPPER_Z_VALUE zval = newIntersectPoints.at( pt );
|
||||
|
||||
// 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 ) )
|
||||
{
|
||||
poly[i].amendArcEnd( shape.first, pt );
|
||||
|
@ -845,7 +846,7 @@ struct FractureEdge
|
|||
{
|
||||
FractureEdge( int y = 0 ) :
|
||||
m_connected( false ),
|
||||
m_next( NULL )
|
||||
m_next( nullptr )
|
||||
{
|
||||
m_p1.x = m_p2.y = y;
|
||||
}
|
||||
|
@ -854,7 +855,7 @@ struct FractureEdge
|
|||
m_connected( connected ),
|
||||
m_p1( p1 ),
|
||||
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 x_nearest = 0;
|
||||
|
||||
FractureEdge* e_nearest = NULL;
|
||||
FractureEdge* e_nearest = nullptr;
|
||||
|
||||
for( FractureEdge* e : edges )
|
||||
{
|
||||
|
@ -951,7 +952,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
|||
{
|
||||
FractureEdgeSet edges;
|
||||
FractureEdgeSet border_edges;
|
||||
FractureEdge* root = NULL;
|
||||
FractureEdge* root = nullptr;
|
||||
|
||||
bool first = true;
|
||||
|
||||
|
@ -965,7 +966,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
|||
const std::vector<VECTOR2I>& points = path.CPoints();
|
||||
int pointCount = points.size();
|
||||
|
||||
FractureEdge* prev = NULL, * first_edge = NULL;
|
||||
FractureEdge* prev = nullptr, * first_edge = nullptr;
|
||||
|
||||
int x_min = std::numeric_limits<int>::max();
|
||||
|
||||
|
@ -1015,7 +1016,7 @@ void SHAPE_POLY_SET::fractureSingle( POLYGON& paths )
|
|||
{
|
||||
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
|
||||
for( FractureEdge* border_edge : border_edges )
|
||||
|
@ -1274,7 +1275,7 @@ int SHAPE_POLY_SET::NormalizeAreaOutlines()
|
|||
|
||||
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() )
|
||||
{
|
||||
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,
|
||||
unsigned int aDistance, int aIndex, int aErrorMax )
|
||||
unsigned int aDistance,
|
||||
int aIndex, int aErrorMax )
|
||||
{
|
||||
// Null segments create serious issues in calculations. Remove them:
|
||||
RemoveNullSegments();
|
||||
|
@ -2204,6 +2206,7 @@ SHAPE_POLY_SET &SHAPE_POLY_SET::operator=( const SHAPE_POLY_SET& aOther )
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
MD5_HASH SHAPE_POLY_SET::GetHash() const
|
||||
{
|
||||
if( !m_hash.IsValid() )
|
||||
|
@ -2323,7 +2326,7 @@ void SHAPE_POLY_SET::CacheTriangulation( bool 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 );
|
||||
flattened.ClearArcs();
|
||||
partitionPolyIntoRegularCellGrid( flattened, 1e7, tmpSet );
|
||||
|
@ -2344,7 +2347,7 @@ void SHAPE_POLY_SET::CacheTriangulation( bool aPartition )
|
|||
m_triangulatedPolys.push_back( std::make_unique<TRIANGULATED_POLYGON>() );
|
||||
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
|
||||
// This may result in multiple, disjoint polygons.
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* 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 )
|
||||
// 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
|
||||
|
||||
return true;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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 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
|
||||
* 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 )
|
||||
{
|
||||
// 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 ) );
|
||||
|
||||
if( !cells )
|
||||
|
@ -101,7 +102,7 @@ void KIPLATFORM::UI::EllipsizeChoiceBox( wxChoice* aChoice )
|
|||
if( !cell )
|
||||
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
|
||||
g_list_free( cells );
|
||||
|
@ -114,7 +115,7 @@ double KIPLATFORM::UI::GetSystemScaleFactor( const wxWindow* aWindow )
|
|||
|
||||
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 );
|
||||
|
||||
return val;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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 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
|
||||
* 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;
|
||||
::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.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;
|
||||
|
||||
int eVal = SHFileOperation( &fileOp );
|
||||
|
@ -70,7 +70,7 @@ bool KIPLATFORM::ENV::IsNetworkPath( const wxString& aPath )
|
|||
|
||||
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
|
||||
if( wxTheApp == nullptr )
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ wxString KIPLATFORM::ENV::GetDocumentsPath()
|
|||
|
||||
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
|
||||
if( wxTheApp == nullptr )
|
||||
{
|
||||
|
@ -100,9 +100,9 @@ wxString KIPLATFORM::ENV::GetUserCachePath()
|
|||
{
|
||||
// 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
|
||||
if( wxTheApp == nullptr )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -118,7 +118,7 @@ namespace SEXPR
|
|||
}
|
||||
else if( *it == ')' )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( *it == '"' )
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
PLEDITOR_PRINTOUT( PL_EDITOR_FRAME* aParent, const wxString& aTitle ) :
|
||||
wxPrintout( aTitle )
|
||||
{
|
||||
wxASSERT( aParent != NULL );
|
||||
wxASSERT( aParent != nullptr );
|
||||
m_parent = aParent;
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,7 @@ public:
|
|||
if( show )
|
||||
{
|
||||
bool centre = false;
|
||||
|
||||
if( s_size.x == 0 || s_size.y == 0 )
|
||||
{
|
||||
s_size = ( m_parent->GetSize() * 3 ) / 4;
|
||||
|
@ -115,6 +116,7 @@ public:
|
|||
|
||||
ret = wxPreviewFrame::Show( show );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -154,9 +156,7 @@ void PLEDITOR_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
|
|||
*maxPage = *selPageTo = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the real print function: print the active screen
|
||||
*/
|
||||
|
||||
void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
|
||||
{
|
||||
wxPoint tmp_startvisu;
|
||||
|
|
|
@ -38,25 +38,39 @@
|
|||
PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
|
||||
PANEL_PROPERTIES_BASE( aParent ),
|
||||
m_scintillaTricks( nullptr ),
|
||||
m_textCtrlTextSizeXBinder( aParent, m_staticTextTsizeX, m_textCtrlTextSizeX, m_TextTextSizeXUnits ),
|
||||
m_textCtrlTextSizeYBinder( aParent, m_staticTextTsizeY, m_textCtrlTextSizeY, m_TextTextSizeYUnits ),
|
||||
m_textCtrlConstraintXBinder( aParent, m_staticTextConstraintX, m_textCtrlConstraintX, m_TextConstraintXUnits ),
|
||||
m_textCtrlConstraintYBinder( aParent, m_staticTextConstraintY, m_textCtrlConstraintY, m_TextConstraintYUnits ),
|
||||
m_textCtrlTextSizeXBinder( aParent, m_staticTextTsizeX, m_textCtrlTextSizeX,
|
||||
m_TextTextSizeXUnits ),
|
||||
m_textCtrlTextSizeYBinder( aParent, m_staticTextTsizeY, m_textCtrlTextSizeY,
|
||||
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_textCtrlPosYBinder( aParent, m_staticTextPosY, m_textCtrlPosY, m_TextPosYUnits ),
|
||||
m_textCtrlEndXBinder( aParent, m_staticTextEndX, m_textCtrlEndX, m_TextEndXUnits ),
|
||||
m_textCtrlEndYBinder( aParent, m_staticTextEndY, m_textCtrlEndY, m_TextEndYUnits ),
|
||||
m_textCtrlStepXBinder( aParent, m_staticTextStepX, m_textCtrlStepX, m_TextStepXUnits ),
|
||||
m_textCtrlStepYBinder( aParent, m_staticTextStepY, m_textCtrlStepY, m_TextStepYUnits ),
|
||||
m_textCtrlDefaultTextSizeXBinder( aParent, m_staticTextDefTsX, m_textCtrlDefaultTextSizeX, m_TextDefaultTextSizeXUnits ),
|
||||
m_textCtrlDefaultTextSizeYBinder( aParent, m_staticTextDefTsY, m_textCtrlDefaultTextSizeY, m_TextDefaultTextSizeYUnits ),
|
||||
m_textCtrlDefaultLineWidthBinder( aParent, m_staticTextDefLineW, m_textCtrlDefaultLineWidth, m_TextDefaultLineWidthUnits ),
|
||||
m_textCtrlDefaultTextThicknessBinder( aParent, m_staticTextDefTextThickness, m_textCtrlDefaultTextThickness, 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_textCtrlDefaultTextSizeXBinder( aParent, m_staticTextDefTsX, m_textCtrlDefaultTextSizeX,
|
||||
m_TextDefaultTextSizeXUnits ),
|
||||
m_textCtrlDefaultTextSizeYBinder( aParent, m_staticTextDefTsY, m_textCtrlDefaultTextSizeY,
|
||||
m_TextDefaultTextSizeYUnits ),
|
||||
m_textCtrlDefaultLineWidthBinder( aParent, m_staticTextDefLineW,
|
||||
m_textCtrlDefaultLineWidth, m_TextDefaultLineWidthUnits ),
|
||||
m_textCtrlDefaultTextThicknessBinder( aParent, m_staticTextDefTextThickness,
|
||||
m_textCtrlDefaultTextThickness,
|
||||
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;
|
||||
|
||||
|
@ -102,7 +116,6 @@ wxSize PROPERTIES_FRAME::GetMinSize() const
|
|||
}
|
||||
|
||||
|
||||
// Data transfer from general properties to widgets
|
||||
void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
||||
{
|
||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||
|
@ -120,13 +133,17 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
|||
m_textCtrlDefaultTextThicknessBinder.SetDoubleValue(
|
||||
From_User_Unit( EDA_UNITS::MILLIMETRES, model.m_DefaultTextThickness ) );
|
||||
|
||||
m_textCtrlLeftMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetLeftMargin() ) );
|
||||
m_textCtrlRightMarginBinder.SetDoubleValue(From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetRightMargin() ) );
|
||||
m_textCtrlTopMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetTopMargin() ) );
|
||||
m_textCtrlBottomMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES, model.GetBottomMargin() ) );
|
||||
m_textCtrlLeftMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||
model.GetLeftMargin() ) );
|
||||
m_textCtrlRightMarginBinder.SetDoubleValue( From_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||
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()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 );
|
||||
item->m_FullText = item->m_TextBase;
|
||||
|
||||
// Replace our '\' 'n' sequence by the EOL char
|
||||
item->ReplaceAntiSlashSequence();
|
||||
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 )
|
||||
{
|
||||
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
||||
|
||||
// Rotation (poly and text)
|
||||
msg.Printf( wxT("%.3f"), item->m_Orient );
|
||||
m_textCtrlRotation->SetValue( msg );
|
||||
|
@ -274,6 +292,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
|||
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
||||
{
|
||||
DS_DATA_ITEM_BITMAP* item = static_cast<DS_DATA_ITEM_BITMAP*>( aItem );
|
||||
|
||||
// select definition in PPI
|
||||
msg.Printf( wxT("%d"), item->GetPPI() );
|
||||
m_textCtrlBitmapDPI->SetValue( msg );
|
||||
|
@ -324,13 +343,13 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
|||
// until the frame is resized). Joys of multiplatform dev.
|
||||
m_swItemProperties->Fit();
|
||||
#endif
|
||||
|
||||
// send a size event to be sure scrollbars will be added/removed as needed
|
||||
m_swItemProperties->PostSizeEvent();
|
||||
m_swItemProperties->Refresh();
|
||||
}
|
||||
|
||||
|
||||
// Event function called by clicking on the OK button
|
||||
void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
||||
{
|
||||
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();
|
||||
CopyPrmsFromPanelToItem( dataItem );
|
||||
|
||||
// Be sure what is displayed is what is set for item
|
||||
// (mainly, texts can be modified if they contain "\n")
|
||||
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 )
|
||||
{
|
||||
if( aItem == NULL )
|
||||
if( aItem == nullptr )
|
||||
return false;
|
||||
|
||||
wxString msg;
|
||||
|
@ -399,7 +418,8 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
|||
}
|
||||
|
||||
// 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
|
||||
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 );
|
||||
aItem->m_RepeatCount = itmp;
|
||||
|
||||
aItem->m_IncrementVector.x = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepXBinder.GetValue() );
|
||||
aItem->m_IncrementVector.y = To_User_Unit( EDA_UNITS::MILLIMETRES, m_textCtrlStepYBinder.GetValue() );
|
||||
aItem->m_IncrementVector.x = To_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||
m_textCtrlStepXBinder.GetValue() );
|
||||
aItem->m_IncrementVector.y = To_User_Unit( EDA_UNITS::MILLIMETRES,
|
||||
m_textCtrlStepYBinder.GetValue() );
|
||||
|
||||
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -49,7 +50,8 @@ static struct IFACE : public KIFACE_I
|
|||
|
||||
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 )
|
||||
{
|
||||
|
@ -57,34 +59,32 @@ static struct IFACE : public KIFACE_I
|
|||
{
|
||||
PL_EDITOR_FRAME* frame = new PL_EDITOR_FRAME( aKiway, aParent );
|
||||
return frame;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
* 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
|
||||
* how the KIFACE interface is exported. But if you know what you are doing
|
||||
* 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 how the KIFACE interface is exported. But if you know what you are doing
|
||||
* use it to retrieve anything you want.
|
||||
*
|
||||
* @param aDataId identifies which object you want the address of.
|
||||
*
|
||||
* @return void* - and must be cast into the know type.
|
||||
* @return the object requested and must be cast into the know type.
|
||||
*/
|
||||
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
|
||||
* the project doesn't know the internal format of the various files (which may have
|
||||
* paths in them that need updating).
|
||||
|
@ -97,10 +97,13 @@ static struct IFACE : public KIFACE_I
|
|||
|
||||
} // namespace
|
||||
|
||||
|
||||
using namespace PGE;
|
||||
|
||||
|
||||
static PGM_BASE* process;
|
||||
|
||||
|
||||
KIFACE_I& Kiface() { return kiface; }
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
* 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,
|
||||
// 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;
|
||||
|
||||
for( ; ii < m_List.size(); ii++ )
|
||||
{
|
||||
if( UTIL::RefDesStringCompare( aItem->m_Name, m_List[ii]->m_Name ) < 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
m_List.insert( m_List.begin() + ii, aItem );
|
||||
}
|
||||
|
||||
|
@ -95,7 +97,7 @@ public:
|
|||
return m_List[ii];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Remove( const wxString & aRegName )
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
* 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" ) );
|
||||
|
||||
if( file == NULL )
|
||||
if( file == nullptr )
|
||||
return false;
|
||||
|
||||
// Switch the locale to standard C (needed to read/write floating point numbers)
|
||||
|
@ -84,6 +84,7 @@ bool PCB_CALCULATOR_FRAME::ReadDataFile()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PCB_CALCULATOR_FRAME::WriteDataFile()
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
static const char* regtype_str[] =
|
||||
{
|
||||
"normal", "3terminal"
|
||||
};
|
||||
|
||||
|
||||
int PCB_CALCULATOR_DATAFILE::WriteHeader( OUTPUTFORMATTER* aFormatter ) const
|
||||
{
|
||||
int nestlevel = 0;
|
||||
|
@ -141,6 +144,7 @@ void PCB_CALCULATOR_DATAFILE::Format( OUTPUTFORMATTER* aFormatter,
|
|||
{
|
||||
// Write regulators list:
|
||||
aFormatter->Print( aNestLevel++, "(%s\n", getTokenName( T_regulators ) );
|
||||
|
||||
for( unsigned ii = 0; ii < m_list->m_List.size(); 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->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_vref ),
|
||||
item->m_Vref );
|
||||
|
||||
if( item->m_Iadj != 0 && item->m_Type == 1)
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_iadj ),
|
||||
item->m_Iadj );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_reg_type ),
|
||||
regtype_str[item->m_Type] );
|
||||
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_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 )
|
||||
{
|
||||
}
|
||||
|
@ -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 )
|
||||
{
|
||||
T token;
|
||||
|
||||
while( ( token = NextTok() ) != T_EOF)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
T token;
|
||||
|
@ -236,28 +243,34 @@ void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFIL
|
|||
{
|
||||
case T_reg_vref: // the voltage reference value
|
||||
token = NextTok();
|
||||
|
||||
if( token != T_NUMBER )
|
||||
Expecting( T_NUMBER );
|
||||
|
||||
sscanf( CurText(), "%lf" , &vref);
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_reg_iadj: // the Iadj reference value
|
||||
token = NextTok();
|
||||
|
||||
if( token != T_NUMBER )
|
||||
Expecting( T_NUMBER );
|
||||
|
||||
sscanf( CurText(), "%lf" , &iadj);
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_reg_type: // type: normal or 3 terminal reg
|
||||
token = NextTok();
|
||||
|
||||
if( strcasecmp( CurText(), regtype_str[0] ) == 0 )
|
||||
type = 0;
|
||||
else if( strcasecmp( CurText(), regtype_str[1] ) == 0 )
|
||||
type = 1;
|
||||
else
|
||||
Unexpected( CurText() );
|
||||
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -271,6 +284,7 @@ void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFIL
|
|||
{
|
||||
if( type != 1 )
|
||||
iadj = 0.0;
|
||||
|
||||
REGULATOR_DATA* new_item = new REGULATOR_DATA( name, vref, type, iadj );
|
||||
aDataList->m_list->Add( new_item );
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -29,9 +29,6 @@
|
|||
const wxString PcbCalcDataFileExt( wxT( "pcbcalc" ) );
|
||||
|
||||
|
||||
// PCB_CALCULATOR_APP
|
||||
|
||||
|
||||
namespace PCBCALC {
|
||||
|
||||
static struct IFACE : public KIFACE_I
|
||||
|
@ -46,35 +43,38 @@ static struct IFACE : public KIFACE_I
|
|||
|
||||
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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
* 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
|
||||
* how the KIFACE interface is exported. But if you know what you are doing
|
||||
* 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 how the KIFACE interface is exported. But if you know what you are doing
|
||||
* use it to retrieve anything you want.
|
||||
*
|
||||
* @param aDataId identifies which object you want the address of.
|
||||
*
|
||||
* @return void* - and must be cast into the know type.
|
||||
* @return the requested object and must be cast into the know type.
|
||||
*/
|
||||
void* IfaceOrAddress( int aDataId ) override
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} kiface( "pcb_calculator", KIWAY::FACE_PCB_CALCULATOR );
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
using namespace PCBCALC;
|
||||
|
||||
static PGM_BASE* process;
|
||||
|
||||
|
||||
KIFACE_I& Kiface() { return kiface; }
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -30,6 +30,7 @@
|
|||
// extension of pcb_calculator data filename:
|
||||
const wxString DataFileNameExt( wxT( "pcbcalc" ) );
|
||||
|
||||
|
||||
PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
PCB_CALCULATOR_FRAME_BASE( aParent ),
|
||||
m_lastNotebookPage( -1 ),
|
||||
|
@ -40,9 +41,9 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_bpButtonSynthetize->SetBitmap( KiBitmap( BITMAPS::small_up ) );
|
||||
|
||||
SetKiway( this, aKiway );
|
||||
m_currTransLine = NULL;
|
||||
m_currTransLine = nullptr;
|
||||
m_currTransLineType = DEFAULT_TYPE;
|
||||
m_currAttenuator = NULL;
|
||||
m_currAttenuator = nullptr;
|
||||
m_RegulatorListChanged = false;
|
||||
m_TWMode = TW_MASTER_CURRENT;
|
||||
m_TWNested = false;
|
||||
|
@ -277,7 +278,7 @@ void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event )
|
|||
|
||||
void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
if( aCfg == NULL )
|
||||
if( aCfg == nullptr )
|
||||
return;
|
||||
|
||||
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 )
|
||||
{
|
||||
if( aCfg == NULL )
|
||||
if( aCfg == nullptr )
|
||||
return;
|
||||
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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()
|
||||
{
|
||||
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
|
||||
* 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() )
|
||||
{
|
||||
m_regulators_fileNameCtrl->SetValue( wxEmptyString );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFileName fn( aFilename );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -78,6 +78,7 @@ void PCB_CALCULATOR_FRAME::RegulatorPageUpdate()
|
|||
m_RegulFormula->SetLabel( wxT( "Vout = Vref * (R1 + R2) / R1 + Iadj * R2" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
// The new icon size must be taken in account
|
||||
m_panelRegulators->GetSizer()->Layout();
|
||||
|
||||
|
@ -100,6 +101,7 @@ void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
|||
{
|
||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
||||
|
||||
if( item )
|
||||
{
|
||||
m_lastSelectedRegulatorName = item->m_Name;
|
||||
|
@ -111,16 +113,12 @@ void PCB_CALCULATOR_FRAME::OnRegulatorSelection( wxCommandEvent& event )
|
|||
m_RegulIadjValue->SetValue( value );
|
||||
}
|
||||
|
||||
// Call RegulatorPageUpdate to enable/sisable tools,
|
||||
// Call RegulatorPageUpdate to enable/disable tools,
|
||||
// even if no item selected
|
||||
RegulatorPageUpdate();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called when ckicking on button Browse:
|
||||
* Select a new data file, and load it on request
|
||||
*/
|
||||
void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
||||
{
|
||||
wxString fullfilename = GetDataFilename();
|
||||
|
@ -143,6 +141,7 @@ void PCB_CALCULATOR_FRAME::OnDataFileSelection( wxCommandEvent& event )
|
|||
return;
|
||||
|
||||
SetDataFilename( fullfilename );
|
||||
|
||||
if( wxFileExists( fullfilename ) && m_RegulatorList.GetCount() > 0 ) // Read file
|
||||
{
|
||||
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() );
|
||||
SelectLastSelectedRegulator();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
wxString msg;
|
||||
|
@ -172,6 +170,7 @@ void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
|||
DIALOG_REGULATOR_FORM dlg( this, wxEmptyString );
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
if( !dlg.IsOK() )
|
||||
{
|
||||
wxMessageBox( _("Bad or missing parameters!") );
|
||||
|
@ -181,7 +180,7 @@ void PCB_CALCULATOR_FRAME::OnAddRegulator( wxCommandEvent& event )
|
|||
REGULATOR_DATA * new_item = dlg.BuildRegulatorFromData();
|
||||
|
||||
// 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
|
||||
m_RegulatorList.Add( new_item );
|
||||
|
@ -203,12 +202,14 @@ void PCB_CALCULATOR_FRAME::OnEditRegulator( wxCommandEvent& event )
|
|||
{
|
||||
wxString name = m_choiceRegulatorSelector->GetStringSelection();
|
||||
REGULATOR_DATA * item = m_RegulatorList.GetReg( name );
|
||||
if( item == NULL )
|
||||
|
||||
if( item == nullptr )
|
||||
return;
|
||||
|
||||
DIALOG_REGULATOR_FORM dlg( this, name );
|
||||
|
||||
dlg.CopyRegulatorDataToDialog( item );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
|
@ -232,6 +233,7 @@ void PCB_CALCULATOR_FRAME::OnRemoveRegulator( wxCommandEvent& event )
|
|||
m_RegulatorListChanged = true;
|
||||
m_choiceRegulatorSelector->Clear();
|
||||
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
|
||||
|
||||
if( m_lastSelectedRegulatorName == name )
|
||||
m_lastSelectedRegulatorName.Empty();
|
||||
|
||||
|
@ -243,15 +245,18 @@ void PCB_CALCULATOR_FRAME::SelectLastSelectedRegulator()
|
|||
{
|
||||
// Find last selected in regulator list:
|
||||
int idx = -1;
|
||||
|
||||
if( !m_lastSelectedRegulatorName.IsEmpty() )
|
||||
{
|
||||
for( unsigned ii = 0; ii < m_RegulatorList.GetCount(); ii++ )
|
||||
{
|
||||
if( m_RegulatorList.m_List[ii]->m_Name == m_lastSelectedRegulatorName )
|
||||
{
|
||||
idx = ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_choiceRegulatorSelector->SetSelection( idx );
|
||||
wxCommandEvent event;
|
||||
|
@ -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()
|
||||
{
|
||||
int id;
|
||||
|
||||
if( m_rbRegulR1->GetValue() )
|
||||
{
|
||||
id = 0; // for R1 calculation
|
||||
}
|
||||
else if( m_rbRegulR2->GetValue() )
|
||||
{
|
||||
id = 1; // for R2 calculation
|
||||
}
|
||||
else if( m_rbRegulVout->GetValue() )
|
||||
{
|
||||
id = 2; // for Vout calculation
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox( wxT("Selection error" ) );
|
||||
|
@ -297,7 +306,6 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
|||
txt = m_RegulVoutValue->GetValue();
|
||||
vout = DoubleFromString(txt);
|
||||
|
||||
|
||||
// Some tests:
|
||||
if( vout < vref && id != 2 )
|
||||
{
|
||||
|
@ -323,6 +331,7 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
|||
// 3 terminal regulator
|
||||
txt = m_RegulIadjValue->GetValue();
|
||||
double iadj = DoubleFromString(txt);
|
||||
|
||||
// iadj is given in micro amp, so convert it in amp.
|
||||
iadj /= 1000000;
|
||||
|
||||
|
@ -346,19 +355,12 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
|||
{ // Standard 4 terminal regulator
|
||||
switch( id )
|
||||
{
|
||||
case 0:
|
||||
r1 = ( vout / vref - 1 ) * r2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
r2 = r1 / ( vout / vref - 1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
vout = vref * (r1 + r2) / r2;
|
||||
break;
|
||||
case 0: r1 = ( vout / vref - 1 ) * 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 );
|
||||
|
@ -368,7 +370,6 @@ void PCB_CALCULATOR_FRAME::RegulatorsSolve()
|
|||
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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
wxArrayString list = StandardLossTangentList();
|
||||
|
@ -147,18 +137,13 @@ void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
|
|||
findMatch( list, prevChoiceStr, prevChoice );
|
||||
|
||||
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Dielectric Loss Factor" ), list,
|
||||
prevChoice, NULL );
|
||||
prevChoice, nullptr );
|
||||
|
||||
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
||||
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 )
|
||||
{
|
||||
wxArrayString list = StandardResistivityList();
|
||||
|
@ -170,7 +155,7 @@ void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event )
|
|||
findMatch( list, prevChoiceStr, prevChoice );
|
||||
|
||||
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Specific Resistance" ), list,
|
||||
prevChoice, NULL );
|
||||
prevChoice, nullptr );
|
||||
|
||||
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
||||
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 )
|
||||
{
|
||||
m_currTransLineType = aType;
|
||||
|
@ -221,17 +198,19 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
|||
wxStaticText* left_msg_list[] =
|
||||
{
|
||||
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[] =
|
||||
{
|
||||
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;
|
||||
|
||||
for( ; jj < tr_ident->m_Messages.GetCount(); jj++ )
|
||||
{
|
||||
if( left_msg_list[jj] == NULL )
|
||||
if( left_msg_list[jj] == nullptr )
|
||||
break;
|
||||
|
||||
left_msg_list[jj]->SetLabel( tr_ident->m_Messages[jj] );
|
||||
|
@ -249,9 +228,9 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
|||
// Init parameters dialog items
|
||||
struct DLG_PRM_DATA substrateprms[] =
|
||||
{
|
||||
{ m_EpsilonR_label, m_Value_EpsilonR, NULL },
|
||||
{ m_TanD_label, m_Value_TanD, NULL },
|
||||
{ m_Rho_label, m_Value_Rho, NULL },
|
||||
{ m_EpsilonR_label, m_Value_EpsilonR, nullptr },
|
||||
{ m_TanD_label, m_Value_TanD, nullptr },
|
||||
{ m_Rho_label, m_Value_Rho, nullptr },
|
||||
{ m_substrate_prm4_label, m_Substrate_prm4_Value, m_SubsPrm4_choiceUnit },
|
||||
{ m_substrate_prm5_label, m_Substrate_prm5_Value, m_SubsPrm5_choiceUnit },
|
||||
{ m_substrate_prm6_label, m_Substrate_prm6_Value, m_SubsPrm6_choiceUnit },
|
||||
|
@ -259,6 +238,7 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
|||
{ m_substrate_prm8_label, m_Substrate_prm8_Value, m_SubsPrm8_choiceUnit },
|
||||
{ m_substrate_prm9_label, m_Substrate_prm9_Value, m_SubsPrm9_choiceUnit }
|
||||
};
|
||||
|
||||
#define substrateprms_cnt (sizeof(substrateprms)/sizeof(substrateprms[0]))
|
||||
|
||||
struct DLG_PRM_DATA physprms[] =
|
||||
|
@ -267,6 +247,7 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
|||
{ m_phys_prm2_label, m_Phys_prm2_Value, m_choiceUnit_Param2 },
|
||||
{ m_phys_prm3_label, m_Phys_prm3_Value, m_choiceUnit_Param3 }
|
||||
};
|
||||
|
||||
#define physprms_cnt (sizeof(physprms)/sizeof(physprms[0]))
|
||||
|
||||
struct DLG_PRM_DATA elecprms[] =
|
||||
|
@ -275,12 +256,14 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
|||
{ m_elec_prm2_label, m_Elec_prm2_Value, m_choiceUnit_ElecPrm2 },
|
||||
{ m_elec_prm3_label, m_Elec_prm3_Value, m_choiceUnit_ElecPrm3 }
|
||||
};
|
||||
|
||||
#define elecprms_cnt (sizeof(elecprms)/sizeof(elecprms[0]))
|
||||
|
||||
struct DLG_PRM_DATA frequencyprms[] =
|
||||
{
|
||||
{ m_Frequency_label,m_Value_Frequency_Ctrl, m_choiceUnit_Frequency }
|
||||
};
|
||||
|
||||
#define frequencyprms_cnt (sizeof(frequencyprms)/sizeof(frequencyprms[0]))
|
||||
|
||||
unsigned idxsubs = 0;
|
||||
|
@ -291,7 +274,8 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
|
|||
for( unsigned ii = 0; ii < tr_ident->GetPrmsCount(); ii++ )
|
||||
{
|
||||
TRANSLINE_PRM* prm = tr_ident->GetPrm( ii );
|
||||
struct DLG_PRM_DATA * data = NULL;
|
||||
struct DLG_PRM_DATA * data = nullptr;
|
||||
|
||||
switch( prm->m_Type )
|
||||
{
|
||||
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()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
TranslineTypeSelection( DEFAULT_TYPE );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -42,16 +42,9 @@
|
|||
#include "transline_ident.h"
|
||||
|
||||
|
||||
/*
|
||||
* TRANSLINE_PRM
|
||||
* A class to handle one parameter of transline
|
||||
*/
|
||||
TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
||||
const char* aKeywordCfg,
|
||||
const wxString& aDlgLabel,
|
||||
const wxString& aToolTip,
|
||||
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_Id = aId;
|
||||
|
@ -60,8 +53,8 @@ TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
|||
m_ToolTip = aToolTip;
|
||||
m_Value = aValue;
|
||||
m_ConvUnit = aConvUnit;
|
||||
m_ValueCtrl = NULL;
|
||||
m_UnitCtrl = NULL;
|
||||
m_ValueCtrl = nullptr;
|
||||
m_UnitCtrl = nullptr;
|
||||
m_UnitSelection = 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 )
|
||||
{
|
||||
m_Type = aType; // The type of transline handled
|
||||
m_Icon = NULL; // An xpm icon to display in dialogs
|
||||
m_TLine = NULL; // The TRANSLINE itself
|
||||
m_Icon = nullptr; // An xpm icon to display in dialogs
|
||||
m_TLine = nullptr; // The TRANSLINE itself
|
||||
m_HasPrmSelection = false; // true if selection of parameters must be enabled in dialog menu
|
||||
|
||||
// Add common prms:
|
||||
|
@ -118,7 +99,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
// Default value is for copper
|
||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, RHO_PRM,
|
||||
"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 ) );
|
||||
|
||||
// Default value is in GHz
|
||||
|
@ -149,10 +131,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
"Rough", _( "Roughness" ),
|
||||
_( "Conductor roughness" ), 0.0, true ) );
|
||||
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 ) );
|
||||
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 ) );
|
||||
|
||||
|
@ -183,7 +167,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
||||
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
||||
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 ) );
|
||||
|
||||
|
@ -216,7 +201,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, T_PRM,
|
||||
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
||||
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 ) );
|
||||
|
||||
|
@ -248,10 +234,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
m_Messages.Add( _( "TM-modes:" ) );
|
||||
|
||||
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 ) );
|
||||
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 ) );
|
||||
|
||||
|
@ -281,10 +269,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
m_Messages.Add( _( "TM-modes:" ) );
|
||||
|
||||
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 ) );
|
||||
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 ) );
|
||||
|
||||
|
@ -327,7 +317,8 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
"Rough", _( "Roughness" ),
|
||||
_( "Conductor roughness" ), 0.0, true ) );
|
||||
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 ) );
|
||||
|
||||
|
@ -340,10 +331,12 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
|
|||
|
||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_E_PRM,
|
||||
"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,
|
||||
"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,
|
||||
"Ang_l", "Ang_l",
|
||||
_( "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,
|
||||
"T", "T", _( "Strip thickness" ), 0.035, true ) );
|
||||
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 ) );
|
||||
|
||||
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" ),
|
||||
_( "Number of twists per length" ), 0.0, false ) );
|
||||
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 ) );
|
||||
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,
|
||||
false ) );
|
||||
AddPrm( new TRANSLINE_PRM( PRM_TYPE_PHYS, PHYS_DIAM_IN_PRM,
|
||||
|
|
|
@ -53,6 +53,10 @@ enum PRM_TYPE {
|
|||
PRM_TYPE_FREQUENCY
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A class to handle one parameter of transline.
|
||||
*/
|
||||
class TRANSLINE_PRM
|
||||
{
|
||||
public:
|
||||
|
@ -62,12 +66,10 @@ public:
|
|||
* @param aDlgLabel is a I18n string used to identify the parameter in dialog.
|
||||
* usually aDlgLabel is same as aKeywordCfg, but translatable.
|
||||
*/
|
||||
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
||||
const char* aKeywordCfg = "",
|
||||
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId, const char* aKeywordCfg = "",
|
||||
const wxString& aDlgLabel = wxEmptyString,
|
||||
const wxString& aToolTip = wxEmptyString,
|
||||
double aValue = 0.0,
|
||||
bool aConvUnit = false );
|
||||
double aValue = 0.0, bool aConvUnit = false );
|
||||
|
||||
double ToUserUnit();
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
@ -105,7 +113,7 @@ public:
|
|||
if( aIdx < m_prms_List.size() )
|
||||
return m_prms_List[aIdx];
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned GetPrmsCount() const
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -52,24 +53,41 @@
|
|||
|
||||
// read and instantiate an IDF component outline
|
||||
static SCENEGRAPH* loadIDFOutline( const wxString& aFileName );
|
||||
|
||||
|
||||
// read and render an IDF board assembly
|
||||
static SCENEGRAPH* loadIDFBoard( const wxString& aFileName );
|
||||
|
||||
|
||||
// model a single extruded outline
|
||||
// idxColor = color index to use
|
||||
// aParent = parent SCENEGRAPH object, if any
|
||||
static SCENEGRAPH* addOutline( IDF3_COMP_OUTLINE* outline, int idxColor, SGNODE* aParent );
|
||||
|
||||
|
||||
// model the board extrusion
|
||||
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent );
|
||||
|
||||
|
||||
// model all included components
|
||||
static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent );
|
||||
|
||||
|
||||
// model any .OTHER_OUTLINE items
|
||||
static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent );
|
||||
|
||||
|
||||
// convert the IDF outline to VRML intermediate data
|
||||
static bool getOutlineModel( VRML_LAYER& model, const std::list< IDF_OUTLINE* >* items );
|
||||
|
||||
|
||||
// convert IDF segment data to VRML segment data
|
||||
static bool addSegment( VRML_LAYER& model, IDF_SEGMENT* seg, int icont, int iseg );
|
||||
|
||||
|
||||
// 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
|
||||
|
@ -105,63 +123,63 @@ static SGNODE* getColor( IFSG_SHAPE& shape, int colorIdx )
|
|||
// green for PCB
|
||||
material.SetSpecular( 0.13f, 0.81f, 0.22f );
|
||||
material.SetDiffuse( 0.13f, 0.81f, 0.22f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// magenta
|
||||
material.SetSpecular( 0.8f, 0.0f, 0.8f );
|
||||
material.SetDiffuse( 0.6f, 0.0f, 0.6f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// red
|
||||
material.SetSpecular( 0.69f, 0.14f, 0.14f );
|
||||
material.SetDiffuse( 0.69f, 0.14f, 0.14f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// orange
|
||||
material.SetSpecular( 1.0f, 0.44f, 0.0f );
|
||||
material.SetDiffuse( 1.0f, 0.44f, 0.0f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// yellow
|
||||
material.SetSpecular( 0.93f, 0.94f, 0.16f );
|
||||
material.SetDiffuse( 0.93f, 0.94f, 0.16f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// blue
|
||||
material.SetSpecular( 0.1f, 0.11f, 0.88f );
|
||||
material.SetDiffuse( 0.1f, 0.11f, 0.88f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// violet
|
||||
material.SetSpecular( 0.32f, 0.07f, 0.64f );
|
||||
material.SetDiffuse( 0.32f, 0.07f, 0.64f );
|
||||
|
||||
// default ambient intensity
|
||||
material.SetShininess( 0.3f );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -178,8 +196,8 @@ const char* GetKicadPluginName( void )
|
|||
}
|
||||
|
||||
|
||||
void GetPluginVersion( unsigned char* Major,
|
||||
unsigned char* Minor, unsigned char* Patch, unsigned char* Revision )
|
||||
void GetPluginVersion( unsigned char* Major, unsigned char* Minor, unsigned char* Patch,
|
||||
unsigned char* Revision )
|
||||
{
|
||||
if( Major )
|
||||
*Major = PLUGIN_3D_IDF_MAJOR;
|
||||
|
@ -192,10 +210,9 @@ void GetPluginVersion( unsigned char* Major,
|
|||
|
||||
if( Revision )
|
||||
*Revision = PLUGIN_3D_IDF_REVNO;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// number of extensions supported
|
||||
#ifdef _WIN32
|
||||
#define NEXTS 2
|
||||
|
@ -203,12 +220,15 @@ void GetPluginVersion( unsigned char* Major,
|
|||
#define NEXTS 4
|
||||
#endif
|
||||
|
||||
|
||||
// number of filter sets supported
|
||||
#define NFILS 2
|
||||
|
||||
|
||||
static char ext0[] = "idf";
|
||||
static char ext1[] = "emn";
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
static char fil0[] = "IDF (*.idf)|*.idf";
|
||||
static char fil1[] = "IDF BRD v2/v3 (*.emn)|*.emn";
|
||||
|
@ -235,8 +255,6 @@ static struct FILE_DATA
|
|||
extensions[2] = ext2;
|
||||
extensions[3] = ext3;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} file_data;
|
||||
|
@ -251,7 +269,7 @@ int GetNExtensions( void )
|
|||
char const* GetModelExtension( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= NEXTS )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return file_data.extensions[aIndex];
|
||||
}
|
||||
|
@ -266,7 +284,7 @@ int GetNFilters( void )
|
|||
char const* GetFileFilter( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= NFILS )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return file_data.filters[aIndex];
|
||||
}
|
||||
|
@ -281,15 +299,15 @@ bool CanRender( void )
|
|||
|
||||
SCENEGRAPH* Load( char const* aFileName )
|
||||
{
|
||||
if( NULL == aFileName )
|
||||
return NULL;
|
||||
if( nullptr == aFileName )
|
||||
return nullptr;
|
||||
|
||||
wxFileName fname;
|
||||
fname.Assign( wxString::FromUTF8Unchecked( aFileName ) );
|
||||
|
||||
wxString ext = fname.GetExt();
|
||||
|
||||
SCENEGRAPH* data = NULL;
|
||||
SCENEGRAPH* data = nullptr;
|
||||
|
||||
if( !ext.Cmp( wxT( "idf" ) ) || !ext.Cmp( wxT( "IDF" ) ) )
|
||||
{
|
||||
|
@ -369,6 +387,7 @@ static bool getOutlineModel( VRML_LAYER& model, const std::list< IDF_OUTLINE* >*
|
|||
eseg = (*scont)->end();
|
||||
|
||||
iseg = 0;
|
||||
|
||||
while( sseg != eseg )
|
||||
{
|
||||
lseg = **sseg;
|
||||
|
@ -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< int > idxPlane;
|
||||
std::vector< int > idxSide;
|
||||
|
@ -462,7 +482,7 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
|
||||
|
@ -476,7 +496,7 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector< SGPOINT > vlist;
|
||||
|
@ -488,13 +508,23 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do
|
|||
|
||||
// create the intermediate scenegraph
|
||||
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
|
||||
IFSG_COORDS* cp = new IFSG_COORDS( *face ); // coordinates for all faces
|
||||
|
||||
// shape will hold (a) all vertices and (b) a local list of normals
|
||||
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] );
|
||||
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] );
|
||||
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
|
||||
j = nvert / 2;
|
||||
|
@ -582,7 +612,7 @@ static SCENEGRAPH* addOutline( IDF3_COMP_OUTLINE* outline, int idxColor, SGNODE*
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vpcb.EnsureWinding( 0, false );
|
||||
|
@ -607,11 +637,11 @@ static SCENEGRAPH* loadIDFOutline( const wxString& aFileName )
|
|||
{
|
||||
LOCALESWITCH switcher;
|
||||
IDF3_BOARD brd( IDF3::CAD_ELEC );
|
||||
IDF3_COMP_OUTLINE* outline = NULL;
|
||||
IDF3_COMP_OUTLINE* outline = nullptr;
|
||||
|
||||
outline = brd.GetComponentOutline( aFileName );
|
||||
|
||||
if( NULL == outline )
|
||||
if( nullptr == outline )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
|
@ -625,10 +655,10 @@ static SCENEGRAPH* loadIDFOutline( const wxString& aFileName )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SCENEGRAPH* data = addOutline( outline, -1, NULL );
|
||||
SCENEGRAPH* data = addOutline( outline, -1, nullptr );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -653,7 +683,7 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IFSG_TRANSFORM tx0( true );
|
||||
|
@ -663,7 +693,7 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
|||
bool noComp = false;
|
||||
bool noOther = false;
|
||||
|
||||
if( NULL == makeBoard( brd, topNode ) )
|
||||
if( nullptr == makeBoard( brd, topNode ) )
|
||||
noBoard = true;
|
||||
|
||||
if( !makeComponents( brd, topNode ) )
|
||||
|
@ -675,7 +705,7 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
|||
if( noBoard && noComp && noOther )
|
||||
{
|
||||
tx0.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (SCENEGRAPH*) topNode;
|
||||
|
@ -684,18 +714,18 @@ static SCENEGRAPH* loadIDFBoard( const wxString& aFileName )
|
|||
|
||||
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent )
|
||||
{
|
||||
if( NULL == aParent )
|
||||
return NULL;
|
||||
if( nullptr == aParent )
|
||||
return nullptr;
|
||||
|
||||
VRML_LAYER vpcb;
|
||||
|
||||
// check if no board outline
|
||||
if( brd.GetBoardOutlinesSize() < 1 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
|
||||
if( !getOutlineModel( vpcb, brd.GetBoardOutline()->GetOutlines() ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
vpcb.EnsureWinding( 0, false );
|
||||
|
||||
|
@ -747,7 +777,7 @@ static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent )
|
|||
|
||||
static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
||||
{
|
||||
if( NULL == aParent )
|
||||
if( nullptr == aParent )
|
||||
return false;
|
||||
|
||||
int ncomponents = 0;
|
||||
|
@ -798,28 +828,27 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
|||
|
||||
pout = (IDF3_COMP_OUTLINE*)((*so)->GetOutline());
|
||||
|
||||
if( NULL == pout )
|
||||
if( nullptr == pout )
|
||||
{
|
||||
++so;
|
||||
continue;
|
||||
}
|
||||
|
||||
dataItem = dataMap.find( pout->GetUID() );
|
||||
SCENEGRAPH* sg = NULL;
|
||||
SCENEGRAPH* sg = nullptr;
|
||||
|
||||
if( dataItem == dataMap.end() )
|
||||
{
|
||||
sg = addOutline( pout, -1, NULL );
|
||||
sg = addOutline( pout, -1, nullptr );
|
||||
|
||||
if( NULL == sg )
|
||||
if( nullptr == sg )
|
||||
{
|
||||
++so;
|
||||
continue;
|
||||
}
|
||||
|
||||
++ncomponents;
|
||||
dataMap.insert( std::pair< std::string, SGNODE* >
|
||||
( pout->GetUID(), (SGNODE*)sg ) );
|
||||
dataMap.insert( std::pair< std::string, SGNODE* >( pout->GetUID(), (SGNODE*)sg ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -830,7 +859,7 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
|||
IFSG_TRANSFORM txN( false );
|
||||
txN.Attach( (SGNODE*)sg );
|
||||
|
||||
if( NULL == txN.GetParent() )
|
||||
if( nullptr == txN.GetParent() )
|
||||
tx0.AddChildNode( txN );
|
||||
else
|
||||
tx0.AddRefNode( txN );
|
||||
|
@ -869,7 +898,7 @@ static bool makeComponents( IDF3_BOARD& brd, SGNODE* aParent )
|
|||
|
||||
static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent )
|
||||
{
|
||||
if( NULL == aParent )
|
||||
if( nullptr == aParent )
|
||||
return false;
|
||||
|
||||
VRML_LAYER vpcb;
|
||||
|
@ -922,7 +951,7 @@ static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent )
|
|||
top = bot + pout->GetThickness();
|
||||
}
|
||||
|
||||
if( NULL == vrmlToSG( vpcb, -1, aParent, top, bot ) )
|
||||
if( nullptr == vrmlToSG( vpcb, -1, aParent, top, bot ) )
|
||||
{
|
||||
vpcb.Clear();
|
||||
++sc;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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) 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -98,12 +98,15 @@ struct DATA;
|
|||
bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||
std::vector< SGNODE* >* items );
|
||||
|
||||
|
||||
bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
||||
std::vector< SGNODE* >* items );
|
||||
|
||||
|
||||
bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
||||
std::vector< SGNODE* >* items, Quantity_Color* color );
|
||||
|
||||
|
||||
struct DATA
|
||||
{
|
||||
Handle( TDocStd_Document ) m_doc;
|
||||
|
@ -120,8 +123,8 @@ struct DATA
|
|||
|
||||
DATA()
|
||||
{
|
||||
scene = NULL;
|
||||
defaultColor = NULL;
|
||||
scene = nullptr;
|
||||
defaultColor = nullptr;
|
||||
refColor.SetValues( Quantity_NOC_BLACK );
|
||||
renderBoth = false;
|
||||
hasSolid = false;
|
||||
|
@ -137,7 +140,7 @@ struct DATA
|
|||
|
||||
while( sC != eC )
|
||||
{
|
||||
if( NULL == S3D::GetSGNodeParent( sC->second ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( sC->second ) )
|
||||
S3D::DestroyNode( sC->second );
|
||||
|
||||
++sC;
|
||||
|
@ -146,7 +149,7 @@ struct DATA
|
|||
colors.clear();
|
||||
}
|
||||
|
||||
if( defaultColor && NULL == S3D::GetSGNodeParent( defaultColor ) )
|
||||
if( defaultColor && nullptr == S3D::GetSGNodeParent( defaultColor ) )
|
||||
S3D::DestroyNode(defaultColor);
|
||||
|
||||
// destroy any faces with no parent
|
||||
|
@ -157,7 +160,7 @@ struct DATA
|
|||
|
||||
while( sF != eF )
|
||||
{
|
||||
if( NULL == S3D::GetSGNodeParent( sF->second ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( sF->second ) )
|
||||
S3D::DestroyNode( sF->second );
|
||||
|
||||
++sF;
|
||||
|
@ -179,7 +182,7 @@ struct DATA
|
|||
|
||||
while( sV != eV )
|
||||
{
|
||||
if( NULL == S3D::GetSGNodeParent( *sV ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( *sV ) )
|
||||
S3D::DestroyNode( *sV );
|
||||
|
||||
++sV;
|
||||
|
@ -194,14 +197,12 @@ struct DATA
|
|||
|
||||
if( scene )
|
||||
S3D::DestroyNode(scene);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// find collection of tagged nodes
|
||||
bool GetShape( const std::string& id, std::vector< SGNODE* >*& listPtr )
|
||||
{
|
||||
listPtr = NULL;
|
||||
listPtr = nullptr;
|
||||
NODEMAP::iterator item;
|
||||
item = shapes.find( id );
|
||||
|
||||
|
@ -219,7 +220,7 @@ struct DATA
|
|||
item = faces.find( id );
|
||||
|
||||
if( item == faces.end() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return item->second;
|
||||
}
|
||||
|
@ -227,7 +228,7 @@ struct DATA
|
|||
// return color if found; if not found, create SGAPPEARANCE
|
||||
SGNODE* GetColor( Quantity_Color* colorObj )
|
||||
{
|
||||
if( NULL == colorObj )
|
||||
if( nullptr == colorObj )
|
||||
{
|
||||
if( defaultColor )
|
||||
return defaultColor;
|
||||
|
@ -344,8 +345,6 @@ void getTag( TDF_Label& label, std::string& aTag )
|
|||
aTag.append( 1, *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 )
|
||||
{
|
||||
if( NULL == lp )
|
||||
if( nullptr == lp )
|
||||
return;
|
||||
|
||||
std::vector< SGNODE* >::iterator sL = lp->begin();
|
||||
|
@ -383,15 +382,13 @@ void addItems( SGNODE* parent, std::vector< SGNODE* >* lp )
|
|||
{
|
||||
item = *sL;
|
||||
|
||||
if( NULL == S3D::GetSGNodeParent( item ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( item ) )
|
||||
S3D::AddSGNodeChild( parent, item );
|
||||
else
|
||||
S3D::AddSGNodeRef( parent, item );
|
||||
|
||||
++sL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -543,22 +540,25 @@ SCENEGRAPH* LoadModel( char const* filename )
|
|||
data.renderBoth = true;
|
||||
|
||||
if( !readIGES( data.m_doc, filename ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
break;
|
||||
|
||||
case FMT_STEP:
|
||||
if( !readSTEP( data.m_doc, filename ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
break;
|
||||
|
||||
case FMT_STPZ:
|
||||
if( !readSTEPZ( data.m_doc, filename ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -581,14 +581,14 @@ SCENEGRAPH* LoadModel( char const* filename )
|
|||
{
|
||||
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;
|
||||
|
||||
++id;
|
||||
};
|
||||
|
||||
if( !ret )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
SCENEGRAPH* scene = (SCENEGRAPH*)data.scene;
|
||||
|
||||
|
@ -611,7 +611,7 @@ SCENEGRAPH* LoadModel( char const* filename )
|
|||
#endif
|
||||
|
||||
// set to NULL to prevent automatic destruction of the scene data
|
||||
data.scene = NULL;
|
||||
data.scene = nullptr;
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
data.hasSolid = true;
|
||||
std::string partID;
|
||||
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)
|
||||
if( !data.m_assy->Search( shape, label ) )
|
||||
|
@ -676,7 +676,8 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
// If the components do not have color information, search all components without location
|
||||
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,
|
||||
Standard_True ) &&
|
||||
getColor( data, label, col ) )
|
||||
{
|
||||
found_color = true;
|
||||
|
@ -684,10 +685,12 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
}
|
||||
}
|
||||
|
||||
// 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( data.m_assy->Search( shape, label, Standard_False, Standard_False, Standard_False ) &&
|
||||
if( data.m_assy->Search( shape, label, Standard_False, Standard_False,
|
||||
Standard_False ) &&
|
||||
getColor( data, label, col ) )
|
||||
{
|
||||
found_color = true;
|
||||
|
@ -716,7 +719,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle );
|
||||
}
|
||||
|
||||
std::vector< SGNODE* >* component = NULL;
|
||||
std::vector< SGNODE* >* component = nullptr;
|
||||
|
||||
if( !partID.empty() )
|
||||
data.GetShape( partID, component );
|
||||
|
@ -725,7 +728,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
{
|
||||
addItems( pptr, component );
|
||||
|
||||
if( NULL != items )
|
||||
if( nullptr != items )
|
||||
items->push_back( pptr );
|
||||
}
|
||||
|
||||
|
@ -742,7 +745,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
|
||||
if( !ret )
|
||||
childNode.Destroy();
|
||||
else if( NULL != items )
|
||||
else if( nullptr != items )
|
||||
items->push_back( pptr );
|
||||
|
||||
return ret;
|
||||
|
@ -782,21 +785,25 @@ bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
case TopAbs_COMPSOLID:
|
||||
if( processComp( subShape, data, pptr, items ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
case TopAbs_SOLID:
|
||||
if( processSolid( subShape, data, pptr, items ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
case TopAbs_SHELL:
|
||||
if( processShell( subShape, data, pptr, items, NULL ) )
|
||||
if( processShell( subShape, data, pptr, items, nullptr ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
case TopAbs_FACE:
|
||||
if( processFace( TopoDS::Face( subShape ), data, pptr, items, NULL ) )
|
||||
if( processFace( TopoDS::Face( subShape ), data, pptr, items, nullptr ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -806,7 +813,7 @@ bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
|
||||
if( !ret )
|
||||
childNode.Destroy();
|
||||
else if( NULL != items )
|
||||
else if( nullptr != items )
|
||||
items->push_back( pptr );
|
||||
|
||||
return ret;
|
||||
|
@ -826,21 +833,25 @@ bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
|
|||
case TopAbs_COMPSOLID:
|
||||
if( processComp( shape, data, parent, items ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
case TopAbs_SOLID:
|
||||
if( processSolid( shape, data, parent, items ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
case TopAbs_SHELL:
|
||||
if( processShell( shape, data, parent, items, NULL ) )
|
||||
if( processShell( shape, data, parent, items, nullptr ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
case TopAbs_FACE:
|
||||
if( processFace( TopoDS::Face( shape ), data, parent, items, NULL ) )
|
||||
if( processFace( TopoDS::Face( shape ), data, parent, items, nullptr ) )
|
||||
ret = true;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -858,7 +869,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
|||
return false;
|
||||
|
||||
bool reverse = ( face.Orientation() == TopAbs_REVERSED );
|
||||
SGNODE* ashape = NULL;
|
||||
SGNODE* ashape = nullptr;
|
||||
std::string partID;
|
||||
TDF_Label label;
|
||||
|
||||
|
@ -877,12 +888,12 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
|||
|
||||
if( ashape )
|
||||
{
|
||||
if( NULL == S3D::GetSGNodeParent( ashape ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( ashape ) )
|
||||
S3D::AddSGNodeChild( parent, ashape );
|
||||
else
|
||||
S3D::AddSGNodeRef( parent, ashape );
|
||||
|
||||
if( NULL != items )
|
||||
if( nullptr != items )
|
||||
items->push_back( ashape );
|
||||
|
||||
if( useBothSides )
|
||||
|
@ -891,12 +902,12 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
|||
id2.append( "b" );
|
||||
SGNODE* shapeB = data.GetFace( id2 );
|
||||
|
||||
if( NULL == S3D::GetSGNodeParent( shapeB ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( shapeB ) )
|
||||
S3D::AddSGNodeChild( parent, shapeB );
|
||||
else
|
||||
S3D::AddSGNodeRef( parent, shapeB );
|
||||
|
||||
if( NULL != items )
|
||||
if( nullptr != items )
|
||||
items->push_back( shapeB );
|
||||
}
|
||||
|
||||
|
@ -944,7 +955,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
|||
IFSG_COORDS vcoords( vface );
|
||||
IFSG_COORDINDEX coordIdx( vface );
|
||||
|
||||
if( NULL == S3D::GetSGNodeParent( ocolor ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( ocolor ) )
|
||||
S3D::AddSGNodeChild( vshape.GetRawPtr(), ocolor );
|
||||
else
|
||||
S3D::AddSGNodeRef( vshape.GetRawPtr(), ocolor );
|
||||
|
@ -974,7 +985,9 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
|||
int tmp = b - 1;
|
||||
b = c - 1;
|
||||
c = tmp;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
b--;
|
||||
c--;
|
||||
}
|
||||
|
@ -993,12 +1006,11 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
|
|||
|
||||
vcoords.SetCoordsList( vertices.size(), &vertices[0] );
|
||||
coordIdx.SetIndices( indices.size(), &indices[0] );
|
||||
vface.CalcNormals( NULL );
|
||||
vface.CalcNormals( nullptr );
|
||||
vshape.SetParent( parent );
|
||||
|
||||
if( !partID.empty() )
|
||||
data.faces.insert( std::pair< std::string,
|
||||
SGNODE* >( partID, vshape.GetRawPtr() ) );
|
||||
data.faces.insert( std::pair< std::string, SGNODE* >( partID, vshape.GetRawPtr() ) );
|
||||
|
||||
// The outer surface of an IGES model is indeterminate so
|
||||
// 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] );
|
||||
coordIdx2.SetIndices( indices2.size(), &indices2[0] );
|
||||
vface2.CalcNormals( NULL );
|
||||
vface2.CalcNormals( nullptr );
|
||||
vshape2.SetParent( parent );
|
||||
|
||||
if( !partID.empty() )
|
||||
data.faces.insert( std::pair< std::string,
|
||||
SGNODE* >( id2, vshape2.GetRawPtr() ) );
|
||||
data.faces.insert( std::pair< std::string, SGNODE* >( id2, vshape2.GetRawPtr() ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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) 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* This plugin implements a STEP/IGES model renderer for KiCad via OCE
|
||||
*/
|
||||
|
||||
|
@ -66,6 +65,7 @@ void GetPluginVersion( unsigned char* Major,
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
static struct FILE_DATA
|
||||
{
|
||||
std::vector<std::string> extensions;
|
||||
|
@ -75,13 +75,21 @@ static struct FILE_DATA
|
|||
{
|
||||
#ifdef _WIN32
|
||||
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 = {
|
||||
"STEP (*.stp;*.step;*.stpz;*.stp.gz;*.step.gz)|*.stp;*.step;*.stpz;*stp.gz;*.step.gz",
|
||||
"IGES (*.igs;*.iges)|*.igs;*.iges" };
|
||||
#else
|
||||
extensions = { "stp","STP","stpZ","stpz","STPZ","step","STEP","stp.gz","STP.GZ","step.gz","STEP.GZ","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" };
|
||||
extensions = {
|
||||
"stp","STP","stpZ","stpz","STPZ","step","STEP","stp.gz","STP.GZ","step.gz","STEP.GZ",
|
||||
"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
|
||||
}
|
||||
|
||||
|
@ -97,7 +105,7 @@ int GetNExtensions( void )
|
|||
char const* GetModelExtension( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= int( file_data.extensions.size() ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return file_data.extensions[aIndex].c_str();
|
||||
}
|
||||
|
@ -112,7 +120,7 @@ int GetNFilters( void )
|
|||
char const* GetFileFilter( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= int( file_data.filters.size() ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return file_data.filters[aIndex].c_str();
|
||||
}
|
||||
|
@ -127,13 +135,13 @@ bool CanRender( void )
|
|||
|
||||
SCENEGRAPH* Load( char const* aFileName )
|
||||
{
|
||||
if( NULL == aFileName )
|
||||
return NULL;
|
||||
if( nullptr == aFileName )
|
||||
return nullptr;
|
||||
|
||||
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
||||
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return LoadModel( aFileName );
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,7 +39,7 @@
|
|||
#include "plugins/3dapi/ifsg_all.h"
|
||||
|
||||
|
||||
WRL1BASE::WRL1BASE() : WRL1NODE( NULL )
|
||||
WRL1BASE::WRL1BASE() : WRL1NODE( nullptr )
|
||||
{
|
||||
m_Type = WRL1NODES::WRL1_BASE;
|
||||
m_dictionary = new NAMEREGISTER;
|
||||
|
@ -48,16 +49,12 @@ WRL1BASE::WRL1BASE() : WRL1NODE( NULL )
|
|||
|
||||
WRL1BASE::~WRL1BASE()
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying virtual base node\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying virtual base node" );
|
||||
|
||||
cancelDict();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// functions inherited from WRL1NODE
|
||||
bool WRL1BASE::SetParent( WRL1NODE* aParent, bool /* doUnlink */ )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
|
@ -129,7 +126,7 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
|||
size_t line, column;
|
||||
proc.GetFilePosData( line, column );
|
||||
|
||||
if( !ReadNode( proc, this, NULL ) )
|
||||
if( !ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||
do {
|
||||
|
@ -165,8 +162,8 @@ bool WRL1BASE::Read( WRLPROC& proc )
|
|||
|
||||
bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( !aParent )
|
||||
{
|
||||
|
@ -201,7 +198,7 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
WRL1NODE* ref = aParent->FindNode( glob );
|
||||
|
||||
// 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 )
|
||||
do {
|
||||
|
@ -231,7 +228,7 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = ref;
|
||||
|
||||
return true;
|
||||
|
@ -240,16 +237,16 @@ bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
|
||||
bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( NULL == aParent )
|
||||
if( nullptr == aParent )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
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() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
@ -258,7 +255,7 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
}
|
||||
|
||||
std::string glob;
|
||||
WRL1NODE* lnode = NULL;
|
||||
WRL1NODE* lnode = nullptr;
|
||||
|
||||
if( !proc.ReadName( glob ) )
|
||||
{
|
||||
|
@ -279,7 +276,7 @@ bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
|
||||
if( ReadNode( proc, aParent, &lnode ) )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = lnode;
|
||||
|
||||
if( lnode && !lnode->SetName( glob ) )
|
||||
|
@ -319,10 +316,10 @@ bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
// must always check the value of aNode when the function returns
|
||||
// 'true' since it will be NULL if the node type is not supported.
|
||||
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( NULL == aParent )
|
||||
if( nullptr == aParent )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -535,8 +532,8 @@ bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1GROUP* np = new WRL1GROUP( m_dictionary, aParent );
|
||||
|
||||
|
@ -546,7 +543,7 @@ bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -555,8 +552,8 @@ bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
|
||||
bool WRL1BASE::readSeparator( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1SEPARATOR* np = new WRL1SEPARATOR( m_dictionary, aParent );
|
||||
|
||||
|
@ -566,7 +563,7 @@ bool WRL1BASE::readSeparator( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -583,7 +580,7 @@ bool WRL1BASE::readSwitch( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -592,8 +589,8 @@ bool WRL1BASE::readSwitch( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
|
||||
bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1MATERIAL* np = new WRL1MATERIAL( m_dictionary, aParent );
|
||||
|
||||
|
@ -603,7 +600,7 @@ bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -612,8 +609,8 @@ bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
|
||||
bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1MATBINDING* np = new WRL1MATBINDING( m_dictionary, aParent );
|
||||
|
||||
|
@ -623,7 +620,7 @@ bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -632,8 +629,8 @@ bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
|||
|
||||
bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1COORDS* np = new WRL1COORDS( m_dictionary, aParent );
|
||||
|
||||
|
@ -643,7 +640,7 @@ bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -652,8 +649,8 @@ bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
|
||||
bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1FACESET* np = new WRL1FACESET( m_dictionary, aParent );
|
||||
|
||||
|
@ -663,7 +660,7 @@ bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -672,8 +669,8 @@ bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
|||
|
||||
bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1TRANSFORM* np = new WRL1TRANSFORM( m_dictionary, aParent );
|
||||
|
||||
|
@ -683,7 +680,7 @@ bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -692,8 +689,8 @@ bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode
|
|||
|
||||
bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL1SHAPEHINTS* np = new WRL1SHAPEHINTS( m_dictionary, aParent );
|
||||
|
||||
|
@ -703,7 +700,7 @@ bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNod
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL1NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -722,10 +719,10 @@ SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
|||
#endif
|
||||
|
||||
if( m_Items.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
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
|
||||
// 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 )
|
||||
{
|
||||
if( NULL != (*sI)->TranslateToSG( node, &m_current ) )
|
||||
if( nullptr != (*sI)->TranslateToSG( node, &m_current ) )
|
||||
hasContent = true;
|
||||
|
||||
++sI;
|
||||
|
@ -752,7 +749,7 @@ SGNODE* WRL1BASE::TranslateToSG( SGNODE* aParent, WRL1STATUS* /*sp*/ )
|
|||
if( !hasContent )
|
||||
{
|
||||
txNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +34,6 @@
|
|||
WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||
{
|
||||
m_Type = WRL1NODES::WRL1_COORDINATE3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,10 +43,8 @@ WRL1COORDS::WRL1COORDS( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
|||
m_Type = WRL1NODES::WRL1_COORDINATE3;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,8 +53,6 @@ WRL1COORDS::~WRL1COORDS()
|
|||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate3 node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,7 +189,7 @@ bool WRL1COORDS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
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
|
||||
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
||||
std::vector< WRLVEC3F >::iterator eP = points.end();
|
||||
|
@ -233,29 +229,26 @@ void WRL1COORDS::GetCoords( WRLVEC3F*& aCoordList, size_t& aListSize )
|
|||
{
|
||||
if( points.size() < 3 )
|
||||
{
|
||||
aCoordList = NULL;
|
||||
aCoordList = nullptr;
|
||||
aListSize = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
aCoordList = &points[0];
|
||||
aListSize = points.size();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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" );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -37,8 +38,6 @@
|
|||
WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||
{
|
||||
m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,10 +47,8 @@ WRL1FACESET::WRL1FACESET( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
|||
m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,8 +63,6 @@ WRL1FACESET::~WRL1FACESET()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,44 +271,40 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
// note: m_sgNode is unused because we cannot manage everything
|
||||
// with a single reused transform due to the fact that VRML1
|
||||
// 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 defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no parent node\n" );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
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" );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
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( NULL == m_current.coord )
|
||||
if( nullptr == m_current.coord )
|
||||
{
|
||||
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" );
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WRLVEC3F* pcoords;
|
||||
|
@ -333,11 +324,11 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// 1. create the vertex/normals/colors lists
|
||||
SGNODE* sgcolor = NULL;
|
||||
SGNODE* sgcolor = nullptr;
|
||||
WRL1_BINDING mbind = m_current.matbind;
|
||||
size_t matSize = matIndex.size();
|
||||
|
||||
|
@ -352,9 +343,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
|
||||
if( matIndex.empty() )
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: per face indexed but no indices\n" );
|
||||
#endif
|
||||
|
||||
// support bad models by temporarily switching bindings
|
||||
mbind = WRL1_BINDING::BIND_OVERALL;
|
||||
|
@ -373,7 +362,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
// copy the data into FACET structures
|
||||
|
||||
SHAPE lShape;
|
||||
FACET* fp = NULL;
|
||||
FACET* fp = nullptr;
|
||||
size_t iCoord;
|
||||
int idx; // coordinate index
|
||||
size_t cidx = 0; // color index
|
||||
|
@ -388,10 +377,10 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
|
||||
if( idx < 0 )
|
||||
{
|
||||
if( NULL != fp )
|
||||
if( nullptr != fp )
|
||||
{
|
||||
if( fp->HasMinPoints() )
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
else
|
||||
fp->Init();
|
||||
}
|
||||
|
@ -403,7 +392,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
if( idx >= (int)coordsize )
|
||||
continue;
|
||||
|
||||
if( NULL == fp )
|
||||
if( nullptr == fp )
|
||||
fp = lShape.NewFacet();
|
||||
|
||||
// push the vertex value and index
|
||||
|
@ -425,10 +414,10 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
|
||||
if( idx < 0 )
|
||||
{
|
||||
if( NULL != fp )
|
||||
if( nullptr != fp )
|
||||
{
|
||||
if( fp->HasMinPoints() )
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
else
|
||||
fp->Init();
|
||||
}
|
||||
|
@ -444,7 +433,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
if( idx >= (int)coordsize )
|
||||
continue;
|
||||
|
||||
if( NULL == fp )
|
||||
if( nullptr == fp )
|
||||
fp = lShape.NewFacet();
|
||||
|
||||
// push the vertex value and index
|
||||
|
@ -476,6 +465,7 @@ SGNODE* WRL1FACESET::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
break;
|
||||
|
||||
case WRL1_BINDING::BIND_PER_FACE_INDEXED:
|
||||
|
||||
if( !fp->HasColors() )
|
||||
{
|
||||
if( cidx >= matSize )
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -39,7 +40,6 @@
|
|||
WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||
{
|
||||
m_Type = WRL1NODES::WRL1_GROUP;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,10 +49,8 @@ WRL1GROUP::WRL1GROUP( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
|||
m_Type = WRL1NODES::WRL1_GROUP;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,15 +65,12 @@ WRL1GROUP::~WRL1GROUP()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// functions inherited from WRL1NODE
|
||||
bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -137,7 +132,7 @@ bool WRL1GROUP::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
proc.GetFilePosData( line, column );
|
||||
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||
do {
|
||||
|
@ -185,21 +180,19 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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" );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else if( NULL == sp )
|
||||
else if( nullptr == sp )
|
||||
{
|
||||
m_current.Init();
|
||||
sp = &m_current;
|
||||
|
@ -207,7 +200,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -219,7 +212,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IFSG_TRANSFORM txNode( aParent );
|
||||
|
@ -232,7 +225,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
|
||||
while( sI != eI )
|
||||
{
|
||||
if( NULL != (*sI)->TranslateToSG( node, sp ) )
|
||||
if( nullptr != (*sI)->TranslateToSG( node, sp ) )
|
||||
hasContent = true;
|
||||
|
||||
++sI;
|
||||
|
@ -241,7 +234,7 @@ SGNODE* WRL1GROUP::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
if( !hasContent )
|
||||
{
|
||||
txNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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_Type = WRL1NODES::WRL1_MATERIALBINDING;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,20 +46,14 @@ WRL1MATBINDING::WRL1MATBINDING( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
|||
m_Type = WRL1NODES::WRL1_MATERIALBINDING;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL1MATBINDING::~WRL1MATBINDING()
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying MaterialBinding node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,7 +93,7 @@ bool WRL1MATBINDING::AddChildNode( WRL1NODE* aNode )
|
|||
|
||||
bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -271,16 +265,14 @@ bool WRL1MATBINDING::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
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\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given" );
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,38 +34,33 @@
|
|||
|
||||
WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||
{
|
||||
colors[0] = NULL;
|
||||
colors[1] = NULL;
|
||||
colors[0] = nullptr;
|
||||
colors[1] = nullptr;
|
||||
m_Type = WRL1NODES::WRL1_MATERIAL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL1MATERIAL::WRL1MATERIAL( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
||||
WRL1NODE( aDictionary )
|
||||
{
|
||||
colors[0] = NULL;
|
||||
colors[1] = NULL;
|
||||
colors[0] = nullptr;
|
||||
colors[1] = nullptr;
|
||||
m_Type = WRL1NODES::WRL1_MATERIAL;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL1MATERIAL::~WRL1MATERIAL()
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node" );
|
||||
|
||||
// destroy any orphaned color nodes
|
||||
for( int i = 0; i < 2; ++i )
|
||||
{
|
||||
if( NULL != colors[i] )
|
||||
if( nullptr != colors[i] )
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
do {
|
||||
|
@ -74,7 +70,7 @@ WRL1MATERIAL::~WRL1MATERIAL()
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
if( NULL == S3D::GetSGNodeParent( colors[i] ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( colors[i] ) )
|
||||
S3D::DestroyNode( colors[i] );
|
||||
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
|
@ -86,8 +82,6 @@ WRL1MATERIAL::~WRL1MATERIAL()
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,13 +121,13 @@ bool WRL1MATERIAL::AddChildNode( WRL1NODE* aNode )
|
|||
|
||||
bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] aTopNode is NULL";
|
||||
ostr << " * [BUG] aTopNode is nullptr";
|
||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
@ -349,18 +343,16 @@ bool WRL1MATERIAL::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
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\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given" );
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sp->mat = this;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -372,7 +364,7 @@ SGNODE* WRL1MATERIAL::GetAppearance( int aIndex )
|
|||
if( aIndex != 0 && aIndex != 1 )
|
||||
aIndex = 0;
|
||||
|
||||
if( NULL != colors[ aIndex ] )
|
||||
if( nullptr != colors[ aIndex ] )
|
||||
return colors[ aIndex ];
|
||||
|
||||
IFSG_APPEARANCE app( true );
|
||||
|
@ -475,7 +467,7 @@ SGNODE* WRL1MATERIAL::GetAppearance( int aIndex )
|
|||
|
||||
void WRL1MATERIAL::GetColor( SGCOLOR* aColor, int aIndex )
|
||||
{
|
||||
if( NULL == aColor )
|
||||
if( nullptr == aColor )
|
||||
return;
|
||||
|
||||
// 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( blue );
|
||||
aColor->SetColor( red, green, blue );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -650,32 +640,28 @@ void WRL1MATERIAL::checkRange( float& aValue )
|
|||
aValue = 0.0;
|
||||
else if( aValue > 1.0 )
|
||||
aValue = 1.0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL1MATERIAL::Reclaim( SGNODE* aColor )
|
||||
{
|
||||
if( NULL == aColor )
|
||||
if( nullptr == aColor )
|
||||
return;
|
||||
|
||||
if( aColor == colors[0] )
|
||||
{
|
||||
if( NULL == S3D::GetSGNodeParent( aColor ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( aColor ) )
|
||||
{
|
||||
colors[0] = NULL;
|
||||
colors[0] = nullptr;
|
||||
S3D::DestroyNode( aColor );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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 )
|
||||
{
|
||||
if( aName.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
std::map< std::string, WRL1NODE* >::iterator ir = reg.find( aName );
|
||||
|
||||
if( ir != reg.end() )
|
||||
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;
|
||||
static NODEMAP nodenames;
|
||||
|
||||
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
std::string WRL1NODE::tabs = "";
|
||||
#endif
|
||||
|
||||
|
||||
WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary )
|
||||
{
|
||||
m_sgNode = NULL;
|
||||
m_Parent = NULL;
|
||||
m_sgNode = nullptr;
|
||||
m_Parent = nullptr;
|
||||
m_Type = WRL1NODES::WRL1_END;
|
||||
m_dictionary = aDictionary;
|
||||
|
||||
|
@ -135,8 +138,6 @@ WRL1NODE::WRL1NODE( NAMEREGISTER* aDictionary )
|
|||
nodenames.insert( NODEITEM( "WWWAnchor", WRL1NODES::WRL1_WWWANCHOR ) );
|
||||
nodenames.insert( NODEITEM( "WWWInline", WRL1NODES::WRL1_WWWINLINE ) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,6 +205,7 @@ WRL1NODE::~WRL1NODE()
|
|||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
++acc;
|
||||
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << " * [INFO] " << otabs << "Type " << m_Type << " is Deleting child #";
|
||||
|
@ -211,7 +213,9 @@ WRL1NODE::~WRL1NODE()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
(*sC)->SetParent( NULL, false );
|
||||
|
||||
(*sC)->SetParent( nullptr, false );
|
||||
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
|
@ -220,7 +224,9 @@ WRL1NODE::~WRL1NODE()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
delete *sC;
|
||||
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
|
@ -229,6 +235,7 @@ WRL1NODE::~WRL1NODE()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
++sC;
|
||||
}
|
||||
|
||||
|
@ -237,7 +244,6 @@ WRL1NODE::~WRL1NODE()
|
|||
#endif
|
||||
|
||||
m_Children.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,11 +258,10 @@ void WRL1NODE::cancelDict( void )
|
|||
++sC;
|
||||
}
|
||||
|
||||
if( m_Type == WRL1NODES::WRL1_BASE && NULL != m_dictionary )
|
||||
if( m_Type == WRL1NODES::WRL1_BASE && nullptr != m_dictionary )
|
||||
delete m_dictionary;
|
||||
|
||||
m_dictionary = NULL;
|
||||
return;
|
||||
m_dictionary = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,8 +283,6 @@ void WRL1NODE::addNodeRef( WRL1NODE* aNode )
|
|||
}
|
||||
|
||||
m_BackPointers.push_back( aNode );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -302,8 +305,6 @@ void WRL1NODE::delNodeRef( WRL1NODE* aNode )
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -415,8 +416,8 @@ std::string WRL1NODE::GetError( void )
|
|||
|
||||
WRL1NODE* WRL1NODE::FindNode( const std::string& aNodeName )
|
||||
{
|
||||
if( NULL == m_dictionary )
|
||||
return NULL;
|
||||
if( nullptr == m_dictionary )
|
||||
return nullptr;
|
||||
|
||||
return m_dictionary->FindName( aNodeName );
|
||||
}
|
||||
|
@ -427,12 +428,12 @@ bool WRL1NODE::SetParent( WRL1NODE* aParent, bool doUnlink )
|
|||
if( aParent == m_Parent )
|
||||
return true;
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -478,7 +479,7 @@ bool WRL1NODE::AddChildNode( WRL1NODE* aNode )
|
|||
|
||||
bool WRL1NODE::AddRefNode( WRL1NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -533,8 +534,6 @@ void WRL1NODE::unlinkChildNode( const WRL1NODE* aNode )
|
|||
|
||||
++sL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -554,15 +553,12 @@ void WRL1NODE::unlinkRefNode( const WRL1NODE* aNode )
|
|||
|
||||
++sL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL1NODE::addItem( WRL1NODE* aNode )
|
||||
{
|
||||
m_Items.push_back( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -581,6 +577,4 @@ void WRL1NODE::delItem( const WRL1NODE* aNode )
|
|||
|
||||
++sL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -67,16 +68,22 @@ struct WRL1STATUS
|
|||
{
|
||||
// material
|
||||
WRL1MATERIAL* mat;
|
||||
|
||||
// normals
|
||||
WRL1NODE* norm;
|
||||
|
||||
// coordinate3
|
||||
WRL1COORDS* coord;
|
||||
|
||||
// material binding
|
||||
WRL1_BINDING matbind;
|
||||
|
||||
// normal binding
|
||||
WRL1_BINDING normbind;
|
||||
|
||||
// transform
|
||||
glm::mat4 txmatrix;
|
||||
|
||||
// winding order of vertices
|
||||
WRL1_ORDER order;
|
||||
|
||||
|
@ -91,11 +98,11 @@ struct WRL1STATUS
|
|||
|
||||
void Init()
|
||||
{
|
||||
mat = NULL;
|
||||
mat = nullptr;
|
||||
matbind = WRL1_BINDING::BIND_OVERALL;
|
||||
norm = NULL;
|
||||
norm = nullptr;
|
||||
normbind = WRL1_BINDING::BIND_DEFAULT;
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
txmatrix = glm::scale( glm::mat4( 1.0 ), glm::vec3( 1.0 ) );
|
||||
order = WRL1_ORDER::ORD_UNKNOWN;
|
||||
creaseLimit = 0.878f;
|
||||
|
@ -105,11 +112,118 @@ struct WRL1STATUS
|
|||
|
||||
|
||||
/**
|
||||
* WRL1NODE
|
||||
* represents the base class of all VRML1 nodes
|
||||
* The base class of all VRML1 nodes
|
||||
*/
|
||||
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:
|
||||
void addItem( WRL1NODE* aNode );
|
||||
void delItem( const WRL1NODE* aNode );
|
||||
|
@ -136,122 +250,6 @@ protected:
|
|||
// dictionary must be propagated to all children as well - perhaps
|
||||
// this is best done via a SetDictionary() function.
|
||||
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
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +34,6 @@
|
|||
WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary ) : WRL1NODE( aDictionary )
|
||||
{
|
||||
m_Type = WRL1NODES::WRL1_SEPARATOR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,10 +43,8 @@ WRL1SEPARATOR::WRL1SEPARATOR( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
|||
m_Type = WRL1NODES::WRL1_SEPARATOR;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,15 +59,12 @@ WRL1SEPARATOR::~WRL1SEPARATOR()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// functions inherited from WRL1NODE
|
||||
bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -131,7 +126,7 @@ bool WRL1SEPARATOR::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
proc.GetFilePosData( line, column );
|
||||
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||
do {
|
||||
|
@ -179,17 +174,17 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( sp != NULL )
|
||||
if( sp != nullptr )
|
||||
m_current = *sp;
|
||||
else
|
||||
m_current.Init();
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -201,7 +196,7 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IFSG_TRANSFORM txNode( aParent );
|
||||
|
@ -214,7 +209,7 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
|
||||
while( sI != eI )
|
||||
{
|
||||
if( NULL != (*sI)->TranslateToSG( node, &m_current ) )
|
||||
if( nullptr != (*sI)->TranslateToSG( node, &m_current ) )
|
||||
hasContent = true;
|
||||
|
||||
++sI;
|
||||
|
@ -223,7 +218,7 @@ SGNODE* WRL1SEPARATOR::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
if( !hasContent )
|
||||
{
|
||||
txNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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_Type = WRL1NODES::WRL1_SHAPEHINTS;
|
||||
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_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL1SHAPEHINTS::~WRL1SHAPEHINTS()
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying ShapeHints node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +96,7 @@ bool WRL1SHAPEHINTS::AddChildNode( WRL1NODE* aNode )
|
|||
|
||||
bool WRL1SHAPEHINTS::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -312,13 +306,11 @@ SGNODE* WRL1SHAPEHINTS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
// note: this is not fully implemented since it is unlikely we shall
|
||||
// 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" );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sp->order = m_order;
|
||||
|
@ -327,5 +319,5 @@ SGNODE* WRL1SHAPEHINTS::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
if( 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.
|
||||
*
|
||||
* 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
|
||||
* 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;
|
||||
whichChild = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,10 +46,8 @@ WRL1SWITCH::WRL1SWITCH( NAMEREGISTER* aDictionary, WRL1NODE* aParent ) :
|
|||
m_Parent = aParent;
|
||||
whichChild = -1;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,12 +62,9 @@ WRL1SWITCH::~WRL1SWITCH()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// functions inherited from WRL1NODE
|
||||
bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
||||
{
|
||||
/*
|
||||
|
@ -82,7 +76,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
* }
|
||||
*/
|
||||
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -198,7 +192,7 @@ bool WRL1SWITCH::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
|
||||
proc.GetFilePosData( line, column );
|
||||
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
|
||||
do {
|
||||
|
@ -236,12 +230,12 @@ SGNODE* WRL1SWITCH::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
#endif
|
||||
|
||||
if( m_Items.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( whichChild < 0 || whichChild >= (int)m_Items.size() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( sp == NULL )
|
||||
if( sp == nullptr )
|
||||
{
|
||||
m_current.Init();
|
||||
sp = &m_current;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
|
@ -61,8 +62,6 @@ WRL1TRANSFORM::~WRL1TRANSFORM()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,7 +79,7 @@ bool WRL1TRANSFORM::Read( WRLPROC& proc, WRL1BASE* aTopNode )
|
|||
* }
|
||||
*/
|
||||
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML1
|
||||
do {
|
||||
|
@ -343,19 +342,17 @@ bool WRL1TRANSFORM::AddChildNode( WRL1NODE* aNode )
|
|||
|
||||
SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
||||
{
|
||||
if( NULL == m_Parent )
|
||||
return NULL;
|
||||
if( nullptr == m_Parent )
|
||||
return nullptr;
|
||||
|
||||
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\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] bad model: no base data given" );
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// rotation
|
||||
|
@ -365,20 +362,24 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
rZ = rotation.z;
|
||||
rW = rotation.w;
|
||||
glm::mat4 rM = glm::rotate( glm::mat4( 1.0f ), rW, glm::vec3( rX, rY, rZ ) );
|
||||
|
||||
// translation
|
||||
float dX, dY, dZ;
|
||||
dX = translation.x;
|
||||
dY = translation.y;
|
||||
dZ = translation.z;
|
||||
glm::mat4 tM = glm::translate( glm::mat4( 1.0f ), glm::vec3( dX, dY, dZ ) );
|
||||
|
||||
// center
|
||||
dX = center.x;
|
||||
dY = center.y;
|
||||
dZ = center.z;
|
||||
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 ) );
|
||||
|
||||
// scale
|
||||
glm::mat4 sM = glm::scale( glm::mat4( 1.0 ), glm::vec3( scale.x, scale.y, scale.z ) );
|
||||
|
||||
// scaleOrientation
|
||||
rX = scaleOrientation.x;
|
||||
rY = scaleOrientation.y;
|
||||
|
@ -391,5 +392,5 @@ SGNODE* WRL1TRANSFORM::TranslateToSG( SGNODE* aParent, WRL1STATUS* sp )
|
|||
// tx' = 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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,26 +34,23 @@
|
|||
|
||||
WRL2APPEARANCE::WRL2APPEARANCE() : WRL2NODE()
|
||||
{
|
||||
material = NULL;
|
||||
texture = NULL;
|
||||
textureTransform = NULL;
|
||||
material = nullptr;
|
||||
texture = nullptr;
|
||||
textureTransform = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_APPEARANCE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2APPEARANCE::WRL2APPEARANCE( WRL2NODE* aParent ) : WRL2NODE()
|
||||
{
|
||||
material = NULL;
|
||||
texture = NULL;
|
||||
textureTransform = NULL;
|
||||
material = nullptr;
|
||||
texture = nullptr;
|
||||
textureTransform = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_APPEARANCE;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +92,7 @@ bool WRL2APPEARANCE::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -103,7 +101,7 @@ bool WRL2APPEARANCE::isDangling( void )
|
|||
|
||||
bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -136,7 +134,7 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_MATERIAL == type )
|
||||
{
|
||||
if( NULL != material )
|
||||
if( nullptr != material )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -156,7 +154,7 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_TEXTURETRANSFORM == type )
|
||||
{
|
||||
if( NULL != textureTransform )
|
||||
if( nullptr != textureTransform )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -174,7 +172,7 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
|||
return WRL2NODE::AddRefNode( aNode );
|
||||
}
|
||||
|
||||
if( NULL != texture )
|
||||
if( nullptr != texture )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -195,7 +193,7 @@ bool WRL2APPEARANCE::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -228,7 +226,7 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_MATERIAL == type )
|
||||
{
|
||||
if( NULL != material )
|
||||
if( nullptr != material )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -248,7 +246,7 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_TEXTURETRANSFORM == type )
|
||||
{
|
||||
if( NULL != textureTransform )
|
||||
if( nullptr != textureTransform )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -266,7 +264,7 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
|||
return WRL2NODE::AddChildNode( aNode );
|
||||
}
|
||||
|
||||
if( NULL != texture )
|
||||
if( nullptr != texture )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -287,7 +285,7 @@ bool WRL2APPEARANCE::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -371,7 +369,7 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
if( !glob.compare( "material" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -387,7 +385,7 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "texture" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -403,7 +401,7 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "textureTransform" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -440,12 +438,12 @@ bool WRL2APPEARANCE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
if( NULL == material && NULL == texture )
|
||||
return NULL;
|
||||
if( nullptr == material && nullptr == texture )
|
||||
return nullptr;
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -457,7 +455,7 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
|
@ -472,24 +470,24 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( m_sgNode )
|
||||
&& !S3D::AddSGNodeRef( aParent, m_sgNode ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return m_sgNode;
|
||||
}
|
||||
|
||||
if( NULL != texture )
|
||||
if( nullptr != texture )
|
||||
{
|
||||
// use a default gray appearance
|
||||
IFSG_APPEARANCE matNode( aParent );
|
||||
|
@ -512,41 +510,38 @@ SGNODE* WRL2APPEARANCE::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
void WRL2APPEARANCE::unlinkChildNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() == this )
|
||||
{
|
||||
if( aNode == material )
|
||||
material = NULL;
|
||||
material = nullptr;
|
||||
else if( aNode == texture )
|
||||
texture = NULL;
|
||||
texture = nullptr;
|
||||
else if( aNode == textureTransform )
|
||||
textureTransform = NULL;
|
||||
textureTransform = nullptr;
|
||||
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkChildNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2APPEARANCE::unlinkRefNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() != this )
|
||||
{
|
||||
if( aNode == material )
|
||||
material = NULL;
|
||||
material = nullptr;
|
||||
else if( aNode == texture )
|
||||
texture = NULL;
|
||||
texture = nullptr;
|
||||
else if( aNode == textureTransform )
|
||||
textureTransform = NULL;
|
||||
|
||||
textureTransform = nullptr;
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkRefNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -47,11 +48,11 @@
|
|||
|
||||
SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline );
|
||||
|
||||
|
||||
WRL2BASE::WRL2BASE() : WRL2NODE()
|
||||
{
|
||||
m_useInline = false;
|
||||
m_Type = WRL2NODES::WRL2_BASE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,19 +66,16 @@ WRL2BASE::~WRL2BASE()
|
|||
SGNODE* np = iS->second;
|
||||
|
||||
// destroy any orphaned Inline{} node data
|
||||
if( np && NULL == S3D::GetSGNodeParent( np ) )
|
||||
if( np && nullptr == S3D::GetSGNodeParent( np ) )
|
||||
S3D::DestroyNode( np );
|
||||
|
||||
++iS;
|
||||
}
|
||||
|
||||
m_inlineModels.clear();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// functions inherited from WRL2NODE
|
||||
bool WRL2BASE::SetParent( WRL2NODE* aParent, bool /* doUnlink */ )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
|
@ -96,7 +94,6 @@ bool WRL2BASE::SetParent( WRL2NODE* aParent, bool /* doUnlink */ )
|
|||
void WRL2BASE::SetEnableInline( bool enable )
|
||||
{
|
||||
m_useInline = enable;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +106,7 @@ bool WRL2BASE::GetEnableInline( void )
|
|||
SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
||||
{
|
||||
if( aName.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
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.length() <= 7 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
|
||||
}
|
||||
|
@ -142,16 +139,16 @@ SGNODE* WRL2BASE::GetInlineData( const std::string& aName )
|
|||
|
||||
if( !fn.Normalize() )
|
||||
{
|
||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
|
||||
return NULL;
|
||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, nullptr ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SCENEGRAPH* sp = LoadVRML( fn.GetFullPath(), false );
|
||||
|
||||
if( NULL == sp )
|
||||
if( nullptr == sp )
|
||||
{
|
||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
|
||||
return NULL;
|
||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, nullptr ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, (SGNODE*)sp ) );
|
||||
|
@ -206,7 +203,7 @@ bool WRL2BASE::Read( WRLPROC& proc )
|
|||
return false;
|
||||
}
|
||||
|
||||
WRL2NODE* node = NULL;
|
||||
WRL2NODE* node = nullptr;
|
||||
m_dir = proc.GetParentDir();
|
||||
|
||||
while( ReadNode( proc, this, &node ) && !proc.eof() );
|
||||
|
@ -227,8 +224,8 @@ bool WRL2BASE::isDangling( void )
|
|||
|
||||
bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( !aParent )
|
||||
{
|
||||
|
@ -260,10 +257,10 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
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
|
||||
if( NULL == ref )
|
||||
if( nullptr == ref )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -293,7 +290,7 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = ref;
|
||||
|
||||
return true;
|
||||
|
@ -302,10 +299,10 @@ bool WRL2BASE::implementUse( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
|
||||
bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( NULL == aParent )
|
||||
if( nullptr == aParent )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -320,7 +317,7 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
}
|
||||
|
||||
std::string glob;
|
||||
WRL2NODE* lnode = NULL;
|
||||
WRL2NODE* lnode = nullptr;
|
||||
|
||||
if( !proc.ReadName( glob ) )
|
||||
{
|
||||
|
@ -341,7 +338,7 @@ bool WRL2BASE::implementDef( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
|
||||
if( ReadNode( proc, aParent, &lnode ) )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = lnode;
|
||||
|
||||
if( lnode && !lnode->SetName( glob ) )
|
||||
|
@ -376,10 +373,10 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
// must always check the value of aNode when the function returns
|
||||
// 'true' since it will be NULL if the node type is not supported.
|
||||
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( NULL == aParent )
|
||||
if( nullptr == aParent )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -863,8 +860,8 @@ bool WRL2BASE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2TRANSFORM* np = new WRL2TRANSFORM( aParent );
|
||||
|
||||
|
@ -874,7 +871,7 @@ bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -883,8 +880,8 @@ bool WRL2BASE::readTransform( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
|
||||
bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2SHAPE* np = new WRL2SHAPE( aParent );
|
||||
|
||||
|
@ -894,7 +891,7 @@ bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -903,8 +900,8 @@ bool WRL2BASE::readShape( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2APPEARANCE* np = new WRL2APPEARANCE( aParent );
|
||||
|
||||
|
@ -914,7 +911,7 @@ bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNod
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -923,8 +920,8 @@ bool WRL2BASE::readAppearance( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNod
|
|||
|
||||
bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2MATERIAL* np = new WRL2MATERIAL( aParent );
|
||||
|
||||
|
@ -934,7 +931,7 @@ bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -943,8 +940,8 @@ bool WRL2BASE::readMaterial( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
|
||||
bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2FACESET* np = new WRL2FACESET( aParent );
|
||||
|
||||
|
@ -954,7 +951,7 @@ bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -963,8 +960,8 @@ bool WRL2BASE::readFaceSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2LINESET* np = new WRL2LINESET( aParent );
|
||||
|
||||
|
@ -974,7 +971,7 @@ bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -983,8 +980,8 @@ bool WRL2BASE::readLineSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2POINTSET* np = new WRL2POINTSET( aParent );
|
||||
|
||||
|
@ -994,7 +991,7 @@ bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1003,8 +1000,8 @@ bool WRL2BASE::readPointSet( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode
|
|||
|
||||
bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2COORDS* np = new WRL2COORDS( aParent );
|
||||
|
||||
|
@ -1014,7 +1011,7 @@ bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1023,8 +1020,8 @@ bool WRL2BASE::readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2NORMS* np = new WRL2NORMS( aParent );
|
||||
|
||||
|
@ -1034,7 +1031,7 @@ bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1043,8 +1040,8 @@ bool WRL2BASE::readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2COLOR* np = new WRL2COLOR( aParent );
|
||||
|
||||
|
@ -1054,7 +1051,7 @@ bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1063,8 +1060,8 @@ bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2BOX* np = new WRL2BOX( aParent );
|
||||
|
||||
|
@ -1074,7 +1071,7 @@ bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1083,8 +1080,8 @@ bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
WRL2SWITCH* np = new WRL2SWITCH( aParent );
|
||||
|
||||
|
@ -1094,7 +1091,7 @@ bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1103,8 +1100,8 @@ bool WRL2BASE::readSwitch( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
|
||||
bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
||||
{
|
||||
if( NULL != aNode )
|
||||
*aNode = NULL;
|
||||
if( nullptr != aNode )
|
||||
*aNode = nullptr;
|
||||
|
||||
if( !m_useInline )
|
||||
{
|
||||
|
@ -1139,7 +1136,7 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != aNode )
|
||||
if( nullptr != aNode )
|
||||
*aNode = (WRL2NODE*) np;
|
||||
|
||||
return true;
|
||||
|
@ -1149,11 +1146,11 @@ bool WRL2BASE::readInline( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode )
|
|||
SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
if( m_Children.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -1165,22 +1162,22 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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() );
|
||||
SGNODE* pshape = (*sC)->TranslateToSG( wrapper.GetRawPtr() );
|
||||
|
||||
if( NULL != pshape )
|
||||
if( nullptr != pshape )
|
||||
test = true;
|
||||
else
|
||||
wrapper.Destroy();
|
||||
|
@ -1222,7 +1219,7 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
|||
case WRL2NODES::WRL2_SWITCH:
|
||||
case WRL2NODES::WRL2_INLINE:
|
||||
|
||||
if( NULL != (*sC)->TranslateToSG( topNode.GetRawPtr() ) )
|
||||
if( nullptr != (*sC)->TranslateToSG( topNode.GetRawPtr() ) )
|
||||
test = true;
|
||||
|
||||
break;
|
||||
|
@ -1237,7 +1234,7 @@ SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent )
|
|||
if( false == test )
|
||||
{
|
||||
topNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_sgNode = topNode.GetRawPtr();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -37,8 +38,6 @@ WRL2BOX::WRL2BOX() : WRL2NODE()
|
|||
size.x = 2.0;
|
||||
size.y = 2.0;
|
||||
size.z = 2.0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,20 +49,14 @@ WRL2BOX::WRL2BOX( WRL2NODE* aParent ) : WRL2NODE()
|
|||
size.y = 2.0;
|
||||
size.z = 2.0;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2BOX::~WRL2BOX()
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Box node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Box node" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,7 +64,7 @@ bool WRL2BOX::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -255,7 +248,7 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
|||
{
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -267,26 +260,26 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// do not render a bad box
|
||||
if( size.x < 1e-6 || size.y < 1e-6 || size.z < 1e-6 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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< int > idx;
|
||||
int base = 0;
|
||||
|
||||
// top
|
||||
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 + 3 );
|
||||
base += 4;
|
||||
|
||||
// bottom
|
||||
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 + 2 );
|
||||
base += 4;
|
||||
|
||||
// front
|
||||
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 + 3 );
|
||||
base += 4;
|
||||
|
||||
// back
|
||||
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 + 2 );
|
||||
base += 4;
|
||||
|
||||
// left
|
||||
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 + 3 );
|
||||
base += 4;
|
||||
|
||||
// right
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +34,6 @@
|
|||
WRL2COLOR::WRL2COLOR() : WRL2NODE()
|
||||
{
|
||||
m_Type = WRL2NODES::WRL2_COLOR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,20 +42,14 @@ WRL2COLOR::WRL2COLOR( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_COLOR;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2COLOR::~WRL2COLOR()
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Color node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Color node" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +57,7 @@ bool WRL2COLOR::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -229,7 +223,7 @@ bool WRL2COLOR::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
SGNODE* WRL2COLOR::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
// 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;
|
||||
green = colors[aIndex].y;
|
||||
blue = colors[aIndex].z;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -264,13 +256,11 @@ void WRL2COLOR::GetColors( WRLVEC3F*& aColorList, size_t& aListSize)
|
|||
{
|
||||
if( colors.empty() )
|
||||
{
|
||||
aColorList = NULL;
|
||||
aColorList = nullptr;
|
||||
aListSize = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
aColorList = &colors[0];
|
||||
aListSize = colors.size();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +34,6 @@
|
|||
WRL2COORDS::WRL2COORDS() : WRL2NODE()
|
||||
{
|
||||
m_Type = WRL2NODES::WRL2_COORDINATE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,20 +42,14 @@ WRL2COORDS::WRL2COORDS( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_COORDINATE;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2COORDS::~WRL2COORDS()
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate node" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +57,7 @@ bool WRL2COORDS::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -201,7 +195,7 @@ bool WRL2COORDS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
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
|
||||
std::vector< WRLVEC3F >::iterator sP = points.begin();
|
||||
std::vector< WRLVEC3F >::iterator eP = points.end();
|
||||
|
@ -241,19 +235,18 @@ void WRL2COORDS::GetCoords( WRLVEC3F*& aCoordList, size_t& aListSize )
|
|||
{
|
||||
if( points.size() < 3 )
|
||||
{
|
||||
aCoordList = NULL;
|
||||
aCoordList = nullptr;
|
||||
aListSize = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
aCoordList = &points[0];
|
||||
aListSize = points.size();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SGNODE* WRL2COORDS::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
// 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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,8 +39,6 @@ WRL2FACESET::WRL2FACESET() : WRL2NODE()
|
|||
{
|
||||
setDefaults();
|
||||
m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,10 +48,8 @@ WRL2FACESET::WRL2FACESET( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,17 +64,15 @@ WRL2FACESET::~WRL2FACESET()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2FACESET::setDefaults( void )
|
||||
{
|
||||
color = NULL;
|
||||
coord = NULL;
|
||||
normal = NULL;
|
||||
texCoord = NULL;
|
||||
color = nullptr;
|
||||
coord = nullptr;
|
||||
normal = nullptr;
|
||||
texCoord = nullptr;
|
||||
|
||||
ccw = true;
|
||||
colorPerVertex = true;
|
||||
|
@ -119,7 +114,7 @@ bool WRL2FACESET::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -128,7 +123,7 @@ bool WRL2FACESET::isDangling( void )
|
|||
|
||||
bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -161,7 +156,7 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COLOR == type )
|
||||
{
|
||||
if( NULL != color )
|
||||
if( nullptr != color )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -181,7 +176,7 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||
{
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -201,7 +196,7 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_NORMAL == type )
|
||||
{
|
||||
if( NULL != normal )
|
||||
if( nullptr != normal )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -233,7 +228,7 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != texCoord )
|
||||
if( nullptr != texCoord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -254,7 +249,7 @@ bool WRL2FACESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -287,7 +282,7 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COLOR == type )
|
||||
{
|
||||
if( NULL != color )
|
||||
if( nullptr != color )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -307,7 +302,7 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||
{
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -327,7 +322,7 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_NORMAL == type )
|
||||
{
|
||||
if( NULL != normal )
|
||||
if( nullptr != normal )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -359,7 +354,7 @@ bool WRL2FACESET::AddChildNode( WRL2NODE* aNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != texCoord )
|
||||
if( nullptr != texCoord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -643,7 +638,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "color" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -659,7 +654,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "coord" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -675,7 +670,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "normal" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -691,7 +686,7 @@ bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "texCoord" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -730,7 +725,7 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
{
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -742,7 +737,7 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
|
@ -758,17 +753,17 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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();
|
||||
|
||||
if( NULL == coord || vsize < 3 )
|
||||
return NULL;
|
||||
if( nullptr == coord || vsize < 3 )
|
||||
return nullptr;
|
||||
|
||||
WRLVEC3F* pcoords;
|
||||
size_t coordsize;
|
||||
((WRL2COORDS*) coord)->GetCoords( pcoords, coordsize );
|
||||
|
||||
if( coordsize < 3 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// check that all indices are valid
|
||||
for( size_t idx = 0; idx < vsize; ++idx )
|
||||
|
@ -794,17 +789,17 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
continue;
|
||||
|
||||
if( coordIndex[idx] >= (int)coordsize )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SHAPE lShape;
|
||||
FACET* fp = NULL;
|
||||
FACET* fp = nullptr;
|
||||
size_t iCoord;
|
||||
int idx; // coordinate index
|
||||
size_t cidx = 0; // color index
|
||||
SGCOLOR pc1;
|
||||
|
||||
if( NULL == color )
|
||||
if( nullptr == color )
|
||||
{
|
||||
// no per-vertex colors; we can save a few CPU cycles
|
||||
for( iCoord = 0; iCoord < vsize; ++iCoord )
|
||||
|
@ -813,10 +808,10 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
if( idx < 0 )
|
||||
{
|
||||
if( NULL != fp )
|
||||
if( nullptr != fp )
|
||||
{
|
||||
if( fp->HasMinPoints() )
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
else
|
||||
fp->Init();
|
||||
}
|
||||
|
@ -828,7 +823,7 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
if( idx >= (int)coordsize )
|
||||
continue;
|
||||
|
||||
if( NULL == fp )
|
||||
if( nullptr == fp )
|
||||
fp = lShape.NewFacet();
|
||||
|
||||
// push the vertex value and index
|
||||
|
@ -846,10 +841,10 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
if( idx < 0 )
|
||||
{
|
||||
if( NULL != fp )
|
||||
if( nullptr != fp )
|
||||
{
|
||||
if( fp->HasMinPoints() )
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
else
|
||||
fp->Init();
|
||||
}
|
||||
|
@ -864,7 +859,7 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
if( idx >= (int)coordsize )
|
||||
continue;
|
||||
|
||||
if( NULL == fp )
|
||||
if( nullptr == fp )
|
||||
fp = lShape.NewFacet();
|
||||
|
||||
// push the vertex value and index
|
||||
|
@ -912,12 +907,12 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
}
|
||||
}
|
||||
|
||||
SGNODE* np = NULL;
|
||||
SGNODE* np = nullptr;
|
||||
|
||||
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
|
||||
np = lShape.CalcShape( aParent, NULL, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
||||
np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
||||
|
||||
return np;
|
||||
}
|
||||
|
@ -925,53 +920,49 @@ SGNODE* WRL2FACESET::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
void WRL2FACESET::unlinkChildNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() == this )
|
||||
{
|
||||
if( aNode == color )
|
||||
color = NULL;
|
||||
color = nullptr;
|
||||
else if( aNode == coord )
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
else if( aNode == normal )
|
||||
normal = NULL;
|
||||
normal = nullptr;
|
||||
else if( aNode == texCoord )
|
||||
texCoord = NULL;
|
||||
|
||||
texCoord = nullptr;
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkChildNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2FACESET::unlinkRefNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() != this )
|
||||
{
|
||||
if( aNode == color )
|
||||
color = NULL;
|
||||
color = nullptr;
|
||||
else if( aNode == coord )
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
else if( aNode == normal )
|
||||
normal = NULL;
|
||||
normal = nullptr;
|
||||
else if( aNode == texCoord )
|
||||
texCoord = NULL;
|
||||
|
||||
texCoord = nullptr;
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkRefNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2FACESET::HasColors( void )
|
||||
{
|
||||
if( NULL == color )
|
||||
if( nullptr == color )
|
||||
return false;
|
||||
|
||||
return ( (WRL2COLOR*) color )->HasColors();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,34 +34,26 @@
|
|||
|
||||
WRL2INLINE::WRL2INLINE() : WRL2NODE()
|
||||
{
|
||||
m_VRML2Base = NULL;
|
||||
m_VRML2Base = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_INLINE;
|
||||
m_Parent = NULL;
|
||||
|
||||
return;
|
||||
m_Parent = nullptr;
|
||||
}
|
||||
|
||||
|
||||
WRL2INLINE::WRL2INLINE( WRL2NODE* aParent ) : WRL2NODE()
|
||||
{
|
||||
m_VRML2Base = NULL;
|
||||
m_VRML2Base = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_INLINE;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2INLINE::~WRL2INLINE()
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
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 )
|
||||
{
|
||||
if( aTopNode == NULL || aTopNode->GetNodeType() != WRL2NODES::WRL2_BASE )
|
||||
if( aTopNode == nullptr || aTopNode->GetNodeType() != WRL2NODES::WRL2_BASE )
|
||||
return false;
|
||||
|
||||
m_VRML2Base = aTopNode;
|
||||
|
@ -268,11 +261,11 @@ bool WRL2INLINE::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
SGNODE* WRL2INLINE::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
if( NULL == aParent || NULL == m_VRML2Base )
|
||||
return NULL;
|
||||
if( nullptr == aParent || nullptr == m_VRML2Base )
|
||||
return nullptr;
|
||||
|
||||
if( url.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
|
@ -288,23 +281,23 @@ SGNODE* WRL2INLINE::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SGNODE* np = m_VRML2Base->GetInlineData( url.front() );
|
||||
|
||||
if( NULL == np )
|
||||
return NULL;
|
||||
if( nullptr == np )
|
||||
return nullptr;
|
||||
|
||||
bool OK = false;
|
||||
|
||||
if( NULL == S3D::GetSGNodeParent( np ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( np ) )
|
||||
OK = S3D::AddSGNodeChild( aParent, np );
|
||||
else
|
||||
OK = S3D::AddSGNodeRef( aParent, np );
|
||||
|
||||
if( !OK )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return np;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -37,8 +38,6 @@ WRL2LINESET::WRL2LINESET() : WRL2NODE()
|
|||
{
|
||||
setDefaults();
|
||||
m_Type = WRL2NODES::WRL2_INDEXEDLINESET;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,10 +47,8 @@ WRL2LINESET::WRL2LINESET( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_INDEXEDLINESET;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,15 +63,13 @@ WRL2LINESET::~WRL2LINESET()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2LINESET::setDefaults( void )
|
||||
{
|
||||
color = NULL;
|
||||
coord = NULL;
|
||||
color = nullptr;
|
||||
coord = nullptr;
|
||||
colorPerVertex = true;
|
||||
}
|
||||
|
||||
|
@ -104,7 +99,7 @@ bool WRL2LINESET::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -113,7 +108,7 @@ bool WRL2LINESET::isDangling( void )
|
|||
|
||||
bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -146,7 +141,7 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COLOR == type )
|
||||
{
|
||||
if( NULL != color )
|
||||
if( nullptr != color )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -166,7 +161,7 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||
{
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -190,7 +185,7 @@ bool WRL2LINESET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -223,7 +218,7 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COLOR == type )
|
||||
{
|
||||
if( NULL != color )
|
||||
if( nullptr != color )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -243,7 +238,7 @@ bool WRL2LINESET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||
{
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -400,7 +395,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "color" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -416,7 +411,7 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "coord" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -454,51 +449,47 @@ bool WRL2LINESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
SGNODE* WRL2LINESET::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
// note: there are no plans to support drawing of lines
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void WRL2LINESET::unlinkChildNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() == this )
|
||||
{
|
||||
if( aNode == color )
|
||||
color = NULL;
|
||||
color = nullptr;
|
||||
else if( aNode == coord )
|
||||
coord = NULL;
|
||||
|
||||
coord = nullptr;
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkChildNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2LINESET::unlinkRefNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() != this )
|
||||
{
|
||||
if( aNode == color )
|
||||
color = NULL;
|
||||
color = nullptr;
|
||||
else if( aNode == coord )
|
||||
coord = NULL;
|
||||
|
||||
coord = nullptr;
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkRefNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2LINESET::HasColors( void )
|
||||
{
|
||||
if( NULL == color )
|
||||
if( nullptr == color )
|
||||
return false;
|
||||
|
||||
return ((WRL2COLOR*) color)->HasColors();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -35,7 +36,6 @@ WRL2MATERIAL::WRL2MATERIAL() : WRL2NODE()
|
|||
{
|
||||
setDefaults();
|
||||
m_Type = WRL2NODES::WRL2_MATERIAL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,20 +45,14 @@ WRL2MATERIAL::WRL2MATERIAL( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_MATERIAL;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2MATERIAL::~WRL2MATERIAL()
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Material node" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,8 +72,6 @@ void WRL2MATERIAL::setDefaults( void )
|
|||
ambientIntensity = 0.2f;
|
||||
shininess = 0.2f;
|
||||
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
|
||||
|
||||
if( NULL == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_APPEARANCE )
|
||||
if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_APPEARANCE )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -130,7 +122,7 @@ bool WRL2MATERIAL::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2MATERIAL::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -354,7 +346,7 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent )
|
|||
{
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -366,7 +358,7 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
|
@ -381,17 +373,17 @@ SGNODE* WRL2MATERIAL::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -44,8 +45,8 @@ static NODEMAP nodenames;
|
|||
|
||||
WRL2NODE::WRL2NODE()
|
||||
{
|
||||
m_sgNode = NULL;
|
||||
m_Parent = NULL;
|
||||
m_sgNode = nullptr;
|
||||
m_Parent = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_END;
|
||||
|
||||
if( badNames.empty() )
|
||||
|
@ -98,12 +99,14 @@ WRL2NODE::WRL2NODE()
|
|||
nodenames.insert( NODEITEM( "NavigationInfo", WRL2NODES::WRL2_NAVIGATIONINFO ) );
|
||||
nodenames.insert( NODEITEM( "Normal", WRL2NODES::WRL2_NORMAL ) );
|
||||
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( "PlaneSensor", WRL2NODES::WRL2_PLANESENSOR ) );
|
||||
nodenames.insert( NODEITEM( "PointLight", WRL2NODES::WRL2_POINTLIGHT ) );
|
||||
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( "ScalarInterpolator", WRL2NODES::WRL2_SCALARINTERPOLATOR ) );
|
||||
nodenames.insert( NODEITEM( "Script", WRL2NODES::WRL2_SCRIPT ) );
|
||||
|
@ -123,8 +126,6 @@ WRL2NODE::WRL2NODE()
|
|||
nodenames.insert( NODEITEM( "VisibilitySensor", WRL2NODES::WRL2_VISIBILITYSENSOR ) );
|
||||
nodenames.insert( NODEITEM( "WorldInfo", WRL2NODES::WRL2_WORLDINFO ) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,13 +158,12 @@ WRL2NODE::~WRL2NODE()
|
|||
|
||||
while( sC != eC )
|
||||
{
|
||||
(*sC)->SetParent( NULL, false );
|
||||
(*sC)->SetParent( nullptr, false );
|
||||
delete *sC;
|
||||
++sC;
|
||||
}
|
||||
|
||||
m_Children.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -180,8 +180,6 @@ void WRL2NODE::addNodeRef( WRL2NODE* aNode )
|
|||
return;
|
||||
|
||||
m_BackPointers.push_back( aNode );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,8 +202,6 @@ void WRL2NODE::delNodeRef( WRL2NODE* aNode )
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,7 +323,7 @@ std::string WRL2NODE::GetError( void )
|
|||
WRL2NODE* WRL2NODE::FindNode( const std::string& aNodeName, const WRL2NODE *aCaller )
|
||||
{
|
||||
if( aNodeName.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( !m_Name.compare( aNodeName ) )
|
||||
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 eLA = m_Children.end();
|
||||
|
||||
WRL2NODE* psg = NULL;
|
||||
WRL2NODE* psg = nullptr;
|
||||
|
||||
while( sLA != eLA )
|
||||
{
|
||||
|
@ -343,17 +339,18 @@ WRL2NODE* WRL2NODE::FindNode( const std::string& aNodeName, const WRL2NODE *aCal
|
|||
{
|
||||
psg = (*sLA)->FindNode( aNodeName, this );
|
||||
|
||||
if( NULL != psg)
|
||||
if( nullptr != psg )
|
||||
return psg;
|
||||
|
||||
}
|
||||
|
||||
++sLA;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent && aCaller != m_Parent )
|
||||
if( nullptr != m_Parent && aCaller != m_Parent )
|
||||
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 )
|
||||
return true;
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -376,7 +373,7 @@ bool WRL2NODE::SetParent( WRL2NODE* aParent, bool doUnlink )
|
|||
|
||||
bool WRL2NODE::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( aNode == NULL )
|
||||
if( aNode == nullptr )
|
||||
return false;
|
||||
|
||||
if( aNode->GetNodeType() == WRL2NODES::WRL2_BASE )
|
||||
|
@ -415,7 +412,7 @@ bool WRL2NODE::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2NODE::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -476,8 +473,6 @@ void WRL2NODE::unlinkChildNode( const WRL2NODE* aNode )
|
|||
|
||||
++sL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -496,6 +491,4 @@ void WRL2NODE::unlinkRefNode( const WRL2NODE* aNode )
|
|||
|
||||
++sL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +34,6 @@
|
|||
WRL2NORMS::WRL2NORMS() : WRL2NODE()
|
||||
{
|
||||
m_Type = WRL2NODES::WRL2_NORMAL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,20 +42,14 @@ WRL2NORMS::WRL2NORMS( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_NORMAL;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2NORMS::~WRL2NORMS()
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 3 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Normal node\n" );
|
||||
#endif
|
||||
|
||||
return;
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Normal node" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +57,7 @@ bool WRL2NORMS::isDangling( void )
|
|||
{
|
||||
// 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 false;
|
||||
|
@ -229,5 +223,5 @@ bool WRL2NORMS::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
SGNODE* WRL2NORMS::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
// 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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -37,8 +38,6 @@ WRL2POINTSET::WRL2POINTSET() : WRL2NODE()
|
|||
{
|
||||
setDefaults();
|
||||
m_Type = WRL2NODES::WRL2_POINTSET;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,10 +47,8 @@ WRL2POINTSET::WRL2POINTSET( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_POINTSET;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,15 +63,13 @@ WRL2POINTSET::~WRL2POINTSET()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2POINTSET::setDefaults( void )
|
||||
{
|
||||
color = NULL;
|
||||
coord = NULL;
|
||||
color = nullptr;
|
||||
coord = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,8 +97,7 @@ bool WRL2POINTSET::checkNodeType( WRL2NODES aType )
|
|||
bool WRL2POINTSET::isDangling( void )
|
||||
{
|
||||
// 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 false;
|
||||
|
@ -112,7 +106,7 @@ bool WRL2POINTSET::isDangling( void )
|
|||
|
||||
bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -145,7 +139,7 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COLOR == type )
|
||||
{
|
||||
if( NULL != color )
|
||||
if( nullptr != color )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -165,7 +159,7 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||
{
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -189,7 +183,7 @@ bool WRL2POINTSET::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -222,7 +216,7 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COLOR == type )
|
||||
{
|
||||
if( NULL != color )
|
||||
if( nullptr != color )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -242,7 +236,7 @@ bool WRL2POINTSET::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_COORDINATE == type )
|
||||
{
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -336,7 +330,7 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
if( !glob.compare( "color" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -352,7 +346,7 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "coord" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -390,51 +384,48 @@ bool WRL2POINTSET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
SGNODE* WRL2POINTSET::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
// note: there are no plans to support drawing of points
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void WRL2POINTSET::unlinkChildNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() == this )
|
||||
{
|
||||
if( aNode == color )
|
||||
color = NULL;
|
||||
color = nullptr;
|
||||
else if( aNode == coord )
|
||||
coord = NULL;
|
||||
|
||||
coord = nullptr;
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkChildNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2POINTSET::unlinkRefNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode->GetParent() != this )
|
||||
{
|
||||
if( aNode == color )
|
||||
color = NULL;
|
||||
color = nullptr;
|
||||
else if( aNode == coord )
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
|
||||
}
|
||||
|
||||
WRL2NODE::unlinkRefNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2POINTSET::HasColors( void )
|
||||
{
|
||||
if( NULL == color )
|
||||
if( nullptr == color )
|
||||
return false;
|
||||
|
||||
return ( (WRL2COLOR*) color )->HasColors();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,24 +35,21 @@
|
|||
|
||||
WRL2SHAPE::WRL2SHAPE() : WRL2NODE()
|
||||
{
|
||||
appearance = NULL;
|
||||
geometry = NULL;
|
||||
appearance = nullptr;
|
||||
geometry = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_SHAPE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2SHAPE::WRL2SHAPE( WRL2NODE* aParent ) : WRL2NODE()
|
||||
{
|
||||
appearance = NULL;
|
||||
geometry = NULL;
|
||||
appearance = nullptr;
|
||||
geometry = nullptr;
|
||||
m_Type = WRL2NODES::WRL2_SHAPE;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,8 +64,6 @@ WRL2SHAPE::~WRL2SHAPE()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,7 +73,7 @@ bool WRL2SHAPE::isDangling( void )
|
|||
// WRL2_TRANSFORM
|
||||
// WRL2_SWITCH
|
||||
|
||||
if( NULL == m_Parent
|
||||
if( nullptr == m_Parent
|
||||
|| ( m_Parent->GetNodeType() != WRL2NODES::WRL2_TRANSFORM
|
||||
&& m_Parent->GetNodeType() != WRL2NODES::WRL2_SWITCH ) )
|
||||
return true;
|
||||
|
@ -88,7 +84,7 @@ bool WRL2SHAPE::isDangling( void )
|
|||
|
||||
bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -121,7 +117,7 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_APPEARANCE == type )
|
||||
{
|
||||
if( NULL != appearance )
|
||||
if( nullptr != appearance )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -139,7 +135,7 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
|||
return WRL2NODE::AddRefNode( aNode );
|
||||
}
|
||||
|
||||
if( NULL != geometry )
|
||||
if( nullptr != geometry )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -160,7 +156,7 @@ bool WRL2SHAPE::AddRefNode( WRL2NODE* aNode )
|
|||
|
||||
bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -193,7 +189,7 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
|||
|
||||
if( WRL2NODES::WRL2_APPEARANCE == type )
|
||||
{
|
||||
if( NULL != appearance )
|
||||
if( nullptr != appearance )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -211,7 +207,7 @@ bool WRL2SHAPE::AddChildNode( WRL2NODE* aNode )
|
|||
return WRL2NODE::AddChildNode( aNode );
|
||||
}
|
||||
|
||||
if( NULL != geometry )
|
||||
if( nullptr != geometry )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -258,7 +254,7 @@ bool WRL2SHAPE::checkNodeType( WRL2NODES aType )
|
|||
|
||||
bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
||||
{
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -341,7 +337,7 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
if( !glob.compare( "appearance" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -357,7 +353,7 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
}
|
||||
else if( !glob.compare( "geometry" ) )
|
||||
{
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
|
||||
do {
|
||||
|
@ -394,8 +390,8 @@ bool WRL2SHAPE::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
if( NULL == geometry )
|
||||
return NULL;
|
||||
if( nullptr == geometry )
|
||||
return nullptr;
|
||||
|
||||
WRL2NODES geomType = geometry->GetNodeType();
|
||||
|
||||
|
@ -404,7 +400,7 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
|||
case WRL2NODES::WRL2_INDEXEDLINESET:
|
||||
case WRL2NODES::WRL2_POINTSET:
|
||||
case WRL2NODES::WRL2_TEXT:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -427,18 +423,18 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
|||
vcolors = ((WRL2FACESET*)geometry)->HasColors();
|
||||
|
||||
// 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() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( !vcolors )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -450,22 +446,22 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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* pGeom = geometry->TranslateToSG( pShape );
|
||||
|
||||
if( NULL == pGeom )
|
||||
if( nullptr == pGeom )
|
||||
{
|
||||
// this can happen if a VRML file contains
|
||||
// empty point or index sets
|
||||
shNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SGNODE* pApp = NULL;
|
||||
SGNODE* pApp = nullptr;
|
||||
|
||||
if( NULL != appearance )
|
||||
if( nullptr != appearance )
|
||||
pApp = appearance->TranslateToSG( pShape );
|
||||
|
||||
if( NULL != appearance && NULL == pApp )
|
||||
if( nullptr != appearance && nullptr == pApp )
|
||||
{
|
||||
IFSG_FACESET tmp( false );
|
||||
tmp.Attach( pGeom );
|
||||
tmp.Destroy();
|
||||
shNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_sgNode = shNode.GetRawPtr();
|
||||
|
@ -507,29 +503,27 @@ SGNODE* WRL2SHAPE::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
void WRL2SHAPE::unlinkChildNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode == appearance )
|
||||
appearance = NULL;
|
||||
appearance = nullptr;
|
||||
else if( aNode == geometry )
|
||||
geometry = NULL;
|
||||
geometry = nullptr;
|
||||
|
||||
WRL2NODE::unlinkChildNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2SHAPE::unlinkRefNode( const WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode == appearance )
|
||||
appearance = NULL;
|
||||
appearance = nullptr;
|
||||
else if( aNode == geometry )
|
||||
geometry = NULL;
|
||||
geometry = nullptr;
|
||||
|
||||
WRL2NODE::unlinkRefNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,8 +35,6 @@ WRL2SWITCH::WRL2SWITCH() : WRL2NODE()
|
|||
{
|
||||
m_Type = WRL2NODES::WRL2_SWITCH;
|
||||
whichChoice = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,10 +44,8 @@ WRL2SWITCH::WRL2SWITCH( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Parent = aParent;
|
||||
whichChoice = -1;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,8 +60,6 @@ WRL2SWITCH::~WRL2SWITCH()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,13 +82,13 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
* }
|
||||
*/
|
||||
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
std::ostringstream ostr;
|
||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
ostr << " * [BUG] aTopNode is NULL";
|
||||
ostr << " * [BUG] aTopNode is nullptr";
|
||||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
@ -215,7 +210,7 @@ bool WRL2SWITCH::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -234,12 +229,12 @@ bool WRL2SWITCH::AddRefNode( WRL2NODE* aNode )
|
|||
{
|
||||
WRL2NODE* np = aNode->GetParent();
|
||||
|
||||
if( NULL != np )
|
||||
if( nullptr != np )
|
||||
aNode->SetParent( this );
|
||||
|
||||
if( !WRL2NODE::AddChildNode( aNode ) )
|
||||
{
|
||||
aNode->SetParent( NULL );
|
||||
aNode->SetParent( nullptr );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +268,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
return false;
|
||||
}
|
||||
|
||||
WRL2NODE* child = NULL;
|
||||
WRL2NODE* child = nullptr;
|
||||
|
||||
if( '[' != tok )
|
||||
{
|
||||
|
@ -281,7 +276,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
if( !aTopNode->ReadNode( proc, this, &child ) )
|
||||
return false;
|
||||
|
||||
if( NULL != child )
|
||||
if( nullptr != child )
|
||||
choices.push_back( child );
|
||||
|
||||
if( proc.Peek() == ',' )
|
||||
|
@ -303,7 +298,7 @@ bool WRL2SWITCH::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
if( !aTopNode->ReadNode( proc, this, &child ) )
|
||||
return false;
|
||||
|
||||
if( NULL != child )
|
||||
if( nullptr != child )
|
||||
choices.push_back( child );
|
||||
|
||||
if( proc.Peek() == ',' )
|
||||
|
@ -329,16 +324,14 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
if( choices.empty() )
|
||||
{
|
||||
#if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Switch translation: no choices\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Switch translation: no choices" );
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -350,7 +343,7 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( whichChoice < 0 || whichChoice >= (int)choices.size() )
|
||||
|
@ -364,7 +357,7 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WRL2NODES type = choices[whichChoice]->GetNodeType();
|
||||
|
@ -378,7 +371,7 @@ SGNODE* WRL2SWITCH::TranslateToSG( SGNODE* aParent )
|
|||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return choices[whichChoice]->TranslateToSG( aParent );
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +34,6 @@
|
|||
WRL2TRANSFORM::WRL2TRANSFORM() : WRL2NODE()
|
||||
{
|
||||
m_Type = WRL2NODES::WRL2_TRANSFORM;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,10 +42,8 @@ WRL2TRANSFORM::WRL2TRANSFORM( WRL2NODE* aParent ) : WRL2NODE()
|
|||
m_Type = WRL2NODES::WRL2_TRANSFORM;
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,8 +58,6 @@ WRL2TRANSFORM::~WRL2TRANSFORM()
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,7 +88,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
* }
|
||||
*/
|
||||
|
||||
if( NULL == aTopNode )
|
||||
if( nullptr == aTopNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -329,7 +325,7 @@ bool WRL2TRANSFORM::Read( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
|
||||
bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -349,13 +345,13 @@ bool WRL2TRANSFORM::AddRefNode( WRL2NODE* aNode )
|
|||
{
|
||||
WRL2NODE* np = aNode->GetParent();
|
||||
|
||||
if( NULL != np )
|
||||
if( nullptr != np )
|
||||
aNode->SetParent( this );
|
||||
|
||||
|
||||
if( !WRL2NODE::AddChildNode( aNode ) )
|
||||
{
|
||||
aNode->SetParent( NULL );
|
||||
aNode->SetParent( nullptr );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +388,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
if( '[' != tok )
|
||||
{
|
||||
// since there are no delimiters we expect a single child
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
return false;
|
||||
|
||||
if( proc.Peek() == ',' )
|
||||
|
@ -411,7 +407,7 @@ bool WRL2TRANSFORM::readChildren( WRLPROC& proc, WRL2BASE* aTopNode )
|
|||
break;
|
||||
}
|
||||
|
||||
if( !aTopNode->ReadNode( proc, this, NULL ) )
|
||||
if( !aTopNode->ReadNode( proc, this, nullptr ) )
|
||||
return false;
|
||||
|
||||
if( proc.Peek() == ',' )
|
||||
|
@ -436,11 +432,11 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
|||
#endif
|
||||
|
||||
if( m_Children.empty() && m_Refs.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_VRML2
|
||||
do {
|
||||
|
@ -452,22 +448,22 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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_TRANSFORM:
|
||||
|
||||
if( NULL != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
||||
if( nullptr != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
||||
test = true;
|
||||
|
||||
break;
|
||||
|
@ -519,7 +515,7 @@ SGNODE* WRL2TRANSFORM::TranslateToSG( SGNODE* aParent )
|
|||
if( false == test )
|
||||
{
|
||||
txNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
txNode.SetScale( SGPOINT( scale.x, scale.y, scale.z ) );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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) 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -24,11 +24,11 @@
|
|||
|
||||
/*
|
||||
* 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
|
||||
* identifying information in the file header:
|
||||
*
|
||||
* #VRML V1.0 ascii
|
||||
* #VRML V1.0 ASCII
|
||||
* #VRML V2.0 utf8
|
||||
*/
|
||||
|
||||
|
@ -61,8 +61,8 @@ const char* GetKicadPluginName( void )
|
|||
}
|
||||
|
||||
|
||||
void GetPluginVersion( unsigned char* Major,
|
||||
unsigned char* Minor, unsigned char* Patch, unsigned char* Revision )
|
||||
void GetPluginVersion( unsigned char* Major, unsigned char* Minor, unsigned char* Patch,
|
||||
unsigned char* Revision )
|
||||
{
|
||||
if( Major )
|
||||
*Major = PLUGIN_VRML_MAJOR;
|
||||
|
@ -111,7 +111,7 @@ int GetNExtensions( void )
|
|||
char const* GetModelExtension( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= int( file_data.extensions.size() ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return file_data.extensions[aIndex].c_str();
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ int GetNFilters( void )
|
|||
char const* GetFileFilter( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= int( file_data.filters.size() ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return file_data.filters[aIndex].c_str();
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class LOCALESWITCH
|
|||
public:
|
||||
LOCALESWITCH()
|
||||
{
|
||||
m_locale = setlocale( LC_NUMERIC, NULL );
|
||||
m_locale = setlocale( LC_NUMERIC, nullptr );
|
||||
setlocale( LC_NUMERIC, "C" );
|
||||
}
|
||||
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
|
||||
SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
||||
{
|
||||
FILE_LINE_READER* modelFile = NULL;
|
||||
SCENEGRAPH* scene = NULL;
|
||||
FILE_LINE_READER* modelFile = nullptr;
|
||||
SCENEGRAPH* scene = nullptr;
|
||||
wxString filename = aFileName;
|
||||
wxFileName tmpfilename;
|
||||
|
||||
|
@ -217,7 +217,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
|||
catch( IO_ERROR & )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 1.0 file\n" );
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 1.0 file" );
|
||||
|
||||
WRL1BASE* bp = new WRL1BASE;
|
||||
|
||||
if( !bp->Read( proc ) )
|
||||
{
|
||||
wxLogTrace( MASK_VRML, " * [INFO] load failed\n" );
|
||||
wxLogTrace( MASK_VRML, " * [INFO] load failed" );
|
||||
}
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 2.0 file\n" );
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Processing VRML 2.0 file" );
|
||||
|
||||
WRL2BASE* bp = new WRL2BASE;
|
||||
|
||||
|
@ -258,20 +258,20 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
|||
|
||||
if( !bp->Read( proc ) )
|
||||
{
|
||||
wxLogTrace( MASK_VRML, " * [INFO] load failed\n" );
|
||||
wxLogTrace( MASK_VRML, " * [INFO] load failed" );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( MASK_VRML, " * [INFO] load completed\n" );
|
||||
wxLogTrace( MASK_VRML, " * [INFO] load completed" );
|
||||
|
||||
// for now we recalculate all normals per-vertex per-face
|
||||
scene = (SCENEGRAPH*)bp->TranslateToSG( NULL );
|
||||
scene = (SCENEGRAPH*)bp->TranslateToSG( nullptr );
|
||||
}
|
||||
|
||||
delete bp;
|
||||
}
|
||||
|
||||
if( NULL != modelFile )
|
||||
if( nullptr != modelFile )
|
||||
delete modelFile;
|
||||
|
||||
// DEBUG: WRITE OUT VRML2 FILE TO CONFIRM STRUCTURE
|
||||
|
@ -299,7 +299,7 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline )
|
|||
|
||||
SCENEGRAPH* LoadX3D( const wxString& aFileName )
|
||||
{
|
||||
SCENEGRAPH* scene = NULL;
|
||||
SCENEGRAPH* scene = nullptr;
|
||||
X3DPARSER model;
|
||||
scene = model.Load( aFileName );
|
||||
|
||||
|
@ -309,17 +309,17 @@ SCENEGRAPH* LoadX3D( const wxString& aFileName )
|
|||
|
||||
SCENEGRAPH* Load( char const* aFileName )
|
||||
{
|
||||
if( NULL == aFileName )
|
||||
return NULL;
|
||||
if( nullptr == aFileName )
|
||||
return nullptr;
|
||||
|
||||
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
||||
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
LOCALESWITCH switcher;
|
||||
|
||||
SCENEGRAPH* scene = NULL;
|
||||
SCENEGRAPH* scene = nullptr;
|
||||
wxString ext = wxFileName( fname ).GetExt();
|
||||
|
||||
if( ext == "x3d" || ext == "X3D" )
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -167,8 +168,6 @@ void FACET::Init()
|
|||
face_normal.y = 0.0;
|
||||
face_normal.z = 0.0;
|
||||
maxIdx = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,8 +199,6 @@ void FACET::AddVertex( WRLVEC3F& aVertex, int aIndex )
|
|||
|
||||
if( aIndex > maxIdx )
|
||||
maxIdx = aIndex;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,8 +407,6 @@ void FACET::CalcVertexNormal( int aIndex, std::list< FACET* > &aFacetList, float
|
|||
++idx;
|
||||
++sI;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -663,8 +658,6 @@ void FACET::CollectVertices( std::vector< std::list< FACET* > >& aFacetList )
|
|||
aFacetList[*sI].push_back( this );
|
||||
++sI;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -681,8 +674,6 @@ void FACET::Renormalize( float aMaxValue )
|
|||
vnweight[i].y /= aMaxValue;
|
||||
vnweight[i].z /= aMaxValue;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -714,7 +705,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
float aCreaseLimit, bool isVRML2 )
|
||||
{
|
||||
if( facets.empty() || !facets.front()->HasMinPoints() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
std::vector< std::list< FACET* > > flist;
|
||||
|
||||
|
@ -744,7 +735,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
++maxIdx;
|
||||
|
||||
if( maxIdx < 3 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
flist.resize( maxIdx );
|
||||
|
||||
|
@ -790,7 +781,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
flist.clear();
|
||||
|
||||
if( vertices.size() < 3 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
IFSG_SHAPE shapeNode( false );
|
||||
|
||||
|
@ -800,7 +791,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
|
||||
if( aColor )
|
||||
{
|
||||
if( NULL == S3D::GetSGNodeParent( aColor ) )
|
||||
if( nullptr == S3D::GetSGNodeParent( aColor ) )
|
||||
shapeNode.AddChildNode( aColor );
|
||||
else
|
||||
shapeNode.AddRefNode( aColor );
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -28,22 +29,31 @@
|
|||
#include <wx/log.h>
|
||||
#include "wrlproc.h"
|
||||
|
||||
#define GETLINE do {\
|
||||
try { \
|
||||
#define GETLINE \
|
||||
do \
|
||||
{ \
|
||||
try \
|
||||
{ \
|
||||
char* cp = m_file->ReadLine(); \
|
||||
if( NULL == cp ) { \
|
||||
if( nullptr == cp ) \
|
||||
{ \
|
||||
m_eof = true; \
|
||||
m_buf.clear(); \
|
||||
} else { \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m_buf = cp; \
|
||||
m_bufpos = 0; \
|
||||
} \
|
||||
m_fileline = m_file->LineNumber(); \
|
||||
} catch( ... ) { \
|
||||
} \
|
||||
catch( ... ) \
|
||||
{ \
|
||||
m_error = " * [INFO] input line too long"; \
|
||||
m_eof = true; \
|
||||
m_buf.clear(); \
|
||||
} } while( 0 )
|
||||
} \
|
||||
} while( 0 )
|
||||
|
||||
|
||||
WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
||||
|
@ -54,7 +64,7 @@ WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
|||
m_bufpos = 0;
|
||||
m_file = aLineReader;
|
||||
|
||||
if( NULL == aLineReader )
|
||||
if( nullptr == aLineReader )
|
||||
{
|
||||
m_eof = true;
|
||||
return;
|
||||
|
@ -119,14 +129,11 @@ WRLPROC::WRLPROC( LINE_READER* aLineReader )
|
|||
m_error.append( m_filename );
|
||||
m_error.append( 1, '\'' );
|
||||
m_badchars.clear();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRLPROC::~WRLPROC()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,7 +234,7 @@ WRLVERSION WRLPROC::GetVRMLType( void )
|
|||
const char* WRLPROC::GetParentDir( void )
|
||||
{
|
||||
if( m_filedir.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return m_filedir.c_str();
|
||||
}
|
||||
|
@ -620,7 +627,8 @@ bool WRLPROC::ReadString( std::string& aSFString )
|
|||
if( !EatSpace() )
|
||||
{
|
||||
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();
|
||||
|
||||
return false;
|
||||
|
@ -677,7 +685,6 @@ bool WRLPROC::ReadString( std::string& aSFString )
|
|||
m_error = ostr.str();
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,13 +737,21 @@ bool WRLPROC::ReadSFBool( bool& aSFBool )
|
|||
return false;
|
||||
|
||||
if( !tmp.compare( "0" ) )
|
||||
{
|
||||
aSFBool = false;
|
||||
}
|
||||
else if( !tmp.compare( "1" ) )
|
||||
{
|
||||
aSFBool = true;
|
||||
}
|
||||
else if( !tmp.compare( "TRUE" ) )
|
||||
{
|
||||
aSFBool = true;
|
||||
}
|
||||
else if( !tmp.compare( "FALSE" ) )
|
||||
{
|
||||
aSFBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
|
@ -1477,7 +1492,6 @@ bool WRLPROC::ReadMFFloat( std::vector< float >& aMFFloat )
|
|||
|
||||
if( ',' == m_buf[m_bufpos] )
|
||||
Pop();
|
||||
|
||||
}
|
||||
|
||||
++m_bufpos;
|
||||
|
@ -1813,7 +1827,6 @@ bool WRLPROC::ReadMFVec2f( std::vector< WRLVEC2F >& aMFVec2f )
|
|||
|
||||
if( ',' == m_buf[m_bufpos] )
|
||||
Pop();
|
||||
|
||||
}
|
||||
|
||||
++m_bufpos;
|
||||
|
@ -2008,6 +2021,4 @@ void WRLPROC::Pop( void )
|
|||
{
|
||||
if( m_bufpos < m_buf.size() )
|
||||
++m_bufpos;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
/*
|
||||
* 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
|
||||
* reimplementation of the legacy x3dmodelparser.cpp and is not
|
||||
* intended to be a compliant X3D implementation.
|
||||
|
@ -49,23 +49,21 @@ SCENEGRAPH* X3DPARSER::Load( const wxString& aFileName )
|
|||
wxXmlDocument doc;
|
||||
|
||||
if( !stream.IsOk() || !doc.Load( stream ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
NODE_LIST children; // VRML Grouping Nodes at top level
|
||||
|
||||
if( !getGroupingNodes( doc.GetRoot(), children ) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
X3D_DICT dictionary; // dictionary for USE/DEF implementation
|
||||
X3DNODE* topNode = new X3DTRANSFORM;
|
||||
bool ok = false;
|
||||
|
||||
for( NODE_LIST::iterator node_it = children.begin();
|
||||
node_it != children.end();
|
||||
++node_it )
|
||||
for( NODE_LIST::iterator node_it = children.begin(); node_it != children.end(); ++node_it )
|
||||
{
|
||||
wxXmlNode* node = *node_it;
|
||||
wxString name = node->GetName();
|
||||
|
@ -81,10 +79,10 @@ SCENEGRAPH* X3DPARSER::Load( const wxString& aFileName )
|
|||
}
|
||||
}
|
||||
|
||||
SCENEGRAPH* sp = NULL;
|
||||
SCENEGRAPH* sp = nullptr;
|
||||
|
||||
if( ok )
|
||||
sp = (SCENEGRAPH*) topNode->TranslateToSG( NULL );
|
||||
sp = (SCENEGRAPH*) topNode->TranslateToSG( nullptr );
|
||||
|
||||
delete topNode;
|
||||
return sp;
|
||||
|
@ -94,11 +92,9 @@ SCENEGRAPH* X3DPARSER::Load( const wxString& aFileName )
|
|||
bool X3DPARSER::getGroupingNodes( wxXmlNode* aNode, std::vector<wxXmlNode*>& aResult )
|
||||
{
|
||||
aResult.clear();
|
||||
wxXmlNode* scene = NULL;
|
||||
wxXmlNode* scene = nullptr;
|
||||
|
||||
for( wxXmlNode* child = aNode->GetChildren();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||
{
|
||||
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;
|
||||
|
||||
for( wxXmlNode* child = scene->GetChildren();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
for( wxXmlNode* child = scene->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||
{
|
||||
const wxString& name = child->GetName();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -45,7 +46,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Type = X3D_APPEARANCE;
|
||||
init();
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES ptype = aParent->GetNodeType();
|
||||
|
||||
|
@ -53,7 +54,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Parent = aParent;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
|
@ -62,9 +63,7 @@ X3DAPP::X3DAPP( X3DNODE* aParent ) : X3DNODE()
|
|||
|
||||
X3DAPP::~X3DAPP()
|
||||
{
|
||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Appearance\n" );
|
||||
#endif
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Appearance" );
|
||||
|
||||
if( !m_MatName.empty() && m_Dict )
|
||||
m_Dict->DelName( m_MatName, this );
|
||||
|
@ -106,9 +105,7 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
|||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
const wxString& pname = prop->GetName();
|
||||
|
||||
|
@ -121,7 +118,7 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
|||
{
|
||||
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;
|
||||
diffuseColor = ap->diffuseColor;
|
||||
|
@ -133,35 +130,42 @@ void X3DAPP::readFields( wxXmlNode* aNode )
|
|||
}
|
||||
}
|
||||
else if( pname == "diffuseColor" )
|
||||
{
|
||||
X3D::ParseSFVec3( prop->GetValue(), diffuseColor );
|
||||
else if( pname == "emissiveColor" )
|
||||
X3D::ParseSFVec3( prop->GetValue(), emissiveColor );
|
||||
else if( pname == "specularColor" )
|
||||
X3D::ParseSFVec3( prop->GetValue(), specularColor );
|
||||
else if( pname == "ambientIntensity" )
|
||||
X3D::ParseSFFloat( prop->GetValue(), ambientIntensity );
|
||||
else if( pname == "shininess" )
|
||||
X3D::ParseSFFloat( prop->GetValue(), shininess );
|
||||
else if( pname == "transparency" )
|
||||
X3D::ParseSFFloat( prop->GetValue(), transparency );
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
else if( pname == "emissiveColor" )
|
||||
{
|
||||
X3D::ParseSFVec3( prop->GetValue(), emissiveColor );
|
||||
}
|
||||
else if( pname == "specularColor" )
|
||||
{
|
||||
X3D::ParseSFVec3( prop->GetValue(), specularColor );
|
||||
}
|
||||
else if( pname == "ambientIntensity" )
|
||||
{
|
||||
X3D::ParseSFFloat( prop->GetValue(), ambientIntensity );
|
||||
}
|
||||
else if( pname == "shininess" )
|
||||
{
|
||||
X3D::ParseSFFloat( prop->GetValue(), shininess );
|
||||
}
|
||||
else if( pname == "transparency" )
|
||||
{
|
||||
X3D::ParseSFFloat( prop->GetValue(), transparency );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool X3DAPP::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||
{
|
||||
if( NULL == aTopNode || NULL == aNode )
|
||||
if( nullptr == aTopNode || nullptr == aNode )
|
||||
return false;
|
||||
|
||||
m_Dict = &aDict;
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
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();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||
{
|
||||
if( child->GetName() == "Material" )
|
||||
pmat = child;
|
||||
|
||||
}
|
||||
|
||||
if( NULL == pmat )
|
||||
if( nullptr == pmat )
|
||||
return false;
|
||||
|
||||
readFields( pmat );
|
||||
|
@ -200,7 +202,7 @@ bool X3DAPP::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
if( aParent == m_Parent )
|
||||
return true;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES nt = aParent->GetNodeType();
|
||||
|
||||
|
@ -208,12 +210,12 @@ bool X3DAPP::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -236,7 +238,7 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent )
|
|||
{
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_X3D
|
||||
std::ostringstream ostr;
|
||||
|
@ -246,7 +248,7 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent )
|
|||
wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||
|
@ -261,17 +263,17 @@ SGNODE* X3DAPP::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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.
|
||||
*
|
||||
* 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
|
||||
* 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 )
|
||||
{
|
||||
if( aName.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
std::map< wxString, X3DNODE* >::iterator ir = reg.find( aName );
|
||||
|
||||
if( ir != reg.end() )
|
||||
return ir->second;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
X3DNODE::X3DNODE()
|
||||
{
|
||||
m_Type = X3D_INVALID;
|
||||
m_Parent = NULL;
|
||||
m_sgNode = NULL;
|
||||
m_Dict = NULL;
|
||||
m_Parent = nullptr;
|
||||
m_sgNode = nullptr;
|
||||
m_Dict = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -91,7 +92,7 @@ X3DNODE::X3DNODE()
|
|||
|
||||
X3DNODE::~X3DNODE()
|
||||
{
|
||||
if( !m_Name.empty() && NULL != m_Dict )
|
||||
if( !m_Name.empty() && nullptr != m_Dict )
|
||||
m_Dict->DelName( m_Name, this );
|
||||
|
||||
return;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,8 +34,6 @@
|
|||
X3DCOORDS::X3DCOORDS() : X3DNODE()
|
||||
{
|
||||
m_Type = X3D_COORDINATE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +41,7 @@ X3DCOORDS::X3DCOORDS( X3DNODE* aParent ) : X3DNODE()
|
|||
{
|
||||
m_Type = X3D_COORDINATE;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES ptype = aParent->GetNodeType();
|
||||
|
||||
|
@ -50,33 +49,26 @@ X3DCOORDS::X3DCOORDS( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Parent = aParent;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
X3DCOORDS::~X3DCOORDS()
|
||||
{
|
||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate\n" );
|
||||
#endif
|
||||
return;
|
||||
wxLogTrace( MASK_VRML, " * [INFO] Destroying Coordinate" );
|
||||
}
|
||||
|
||||
|
||||
bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||
{
|
||||
if( NULL == aTopNode || NULL == aNode )
|
||||
if( nullptr == aTopNode || nullptr == aNode )
|
||||
return false;
|
||||
|
||||
m_Dict = &aDict;
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
const wxString& pname = prop->GetName();
|
||||
|
||||
|
@ -124,7 +116,6 @@ bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
|||
|
||||
++i;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +134,7 @@ bool X3DCOORDS::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
if( aParent == m_Parent )
|
||||
return true;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES nt = aParent->GetNodeType();
|
||||
|
||||
|
@ -151,12 +142,12 @@ bool X3DCOORDS::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -179,18 +170,17 @@ void X3DCOORDS::GetCoords( WRLVEC3F*& aCoordList, size_t& aListSize )
|
|||
{
|
||||
if( points.size() < 3 )
|
||||
{
|
||||
aCoordList = NULL;
|
||||
aCoordList = nullptr;
|
||||
aListSize = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
aCoordList = &points[0];
|
||||
aListSize = points.size();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,7 +39,7 @@
|
|||
X3DIFACESET::X3DIFACESET() : X3DNODE()
|
||||
{
|
||||
m_Type = X3D_INDEXED_FACE_SET;
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
init();
|
||||
|
||||
return;
|
||||
|
@ -48,10 +49,10 @@ X3DIFACESET::X3DIFACESET() : X3DNODE()
|
|||
X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
|
||||
{
|
||||
m_Type = X3D_INDEXED_FACE_SET;
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
init();
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES ptype = aParent->GetNodeType();
|
||||
|
||||
|
@ -59,7 +60,7 @@ X3DIFACESET::X3DIFACESET( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Parent = aParent;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
|
@ -78,7 +79,7 @@ X3DIFACESET::~X3DIFACESET()
|
|||
|
||||
void X3DIFACESET::init()
|
||||
{
|
||||
coord = NULL;
|
||||
coord = nullptr;
|
||||
|
||||
ccw = true;
|
||||
creaseAngle = 0.733f; // approx 42 degrees; this is larger than VRML spec.
|
||||
|
@ -96,9 +97,7 @@ void X3DIFACESET::readFields( wxXmlNode* aNode )
|
|||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
const wxString& pname = prop->GetName();
|
||||
|
||||
|
@ -108,7 +107,9 @@ void X3DIFACESET::readFields( wxXmlNode* aNode )
|
|||
m_Dict->AddName( m_Name, this );
|
||||
}
|
||||
else if( pname == "ccw" )
|
||||
{
|
||||
X3D::ParseSFBool( prop->GetValue(), ccw );
|
||||
}
|
||||
else if( pname == "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 )
|
||||
{
|
||||
if( NULL == aTopNode || NULL == aNode )
|
||||
if( nullptr == aTopNode || nullptr == aNode )
|
||||
return false;
|
||||
|
||||
m_Dict = &aDict;
|
||||
readFields( aNode );
|
||||
bool ok = false;
|
||||
|
||||
for( wxXmlNode* child = aNode->GetChildren();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||
{
|
||||
if( child->GetName() == "Coordinate" )
|
||||
ok = X3D::ReadCoordinates( child, this, aDict );
|
||||
|
@ -171,7 +170,7 @@ bool X3DIFACESET::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
if( aParent == m_Parent )
|
||||
return true;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES nt = aParent->GetNodeType();
|
||||
|
||||
|
@ -179,12 +178,12 @@ bool X3DIFACESET::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -193,7 +192,7 @@ bool X3DIFACESET::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
|
||||
bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return false;
|
||||
|
||||
if( aNode->GetNodeType() != X3D_COORDINATE )
|
||||
|
@ -202,7 +201,7 @@ bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
|||
if( aNode == coord )
|
||||
return true;
|
||||
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
return false;
|
||||
|
||||
m_Children.push_back( aNode );
|
||||
|
@ -217,7 +216,7 @@ bool X3DIFACESET::AddChildNode( X3DNODE* aNode )
|
|||
|
||||
bool X3DIFACESET::AddRefNode( X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return false;
|
||||
|
||||
if( aNode->GetNodeType() != X3D_COORDINATE )
|
||||
|
@ -226,7 +225,7 @@ bool X3DIFACESET::AddRefNode( X3DNODE* aNode )
|
|||
if( aNode == coord )
|
||||
return true;
|
||||
|
||||
if( NULL != coord )
|
||||
if( nullptr != coord )
|
||||
return false;
|
||||
|
||||
m_Refs.push_back( aNode );
|
||||
|
@ -240,7 +239,7 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
|||
{
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_SHAPE )
|
||||
{
|
||||
#ifdef DEBUG_X3D
|
||||
do {
|
||||
|
@ -252,7 +251,7 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||
|
@ -268,17 +267,17 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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();
|
||||
|
||||
if( NULL == coord || vsize < 3 )
|
||||
return NULL;
|
||||
if( nullptr == coord || vsize < 3 )
|
||||
return nullptr;
|
||||
|
||||
WRLVEC3F* pcoords;
|
||||
size_t coordsize;
|
||||
((X3DCOORDS*) coord)->GetCoords( pcoords, coordsize );
|
||||
|
||||
if( coordsize < 3 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// check that all indices are valid
|
||||
for( size_t idx = 0; idx < vsize; ++idx )
|
||||
|
@ -304,11 +303,11 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
|||
continue;
|
||||
|
||||
if( coordIndex[idx] >= (int)coordsize )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SHAPE lShape;
|
||||
FACET* fp = NULL;
|
||||
FACET* fp = nullptr;
|
||||
size_t iCoord;
|
||||
int idx; // coordinate index
|
||||
|
||||
|
@ -319,10 +318,10 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
if( idx < 0 )
|
||||
{
|
||||
if( NULL != fp )
|
||||
if( nullptr != fp )
|
||||
{
|
||||
if( fp->HasMinPoints() )
|
||||
fp = NULL;
|
||||
fp = nullptr;
|
||||
else
|
||||
fp->Init();
|
||||
}
|
||||
|
@ -334,19 +333,19 @@ SGNODE* X3DIFACESET::TranslateToSG( SGNODE* aParent )
|
|||
if( idx >= (int)coordsize )
|
||||
continue;
|
||||
|
||||
if( NULL == fp )
|
||||
if( nullptr == fp )
|
||||
fp = lShape.NewFacet();
|
||||
|
||||
// push the vertex value and index
|
||||
fp->AddVertex( pcoords[idx], idx );
|
||||
}
|
||||
|
||||
SGNODE* np = NULL;
|
||||
SGNODE* np = nullptr;
|
||||
|
||||
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
|
||||
np = lShape.CalcShape( aParent, NULL, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
||||
np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
|
||||
|
||||
return np;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* 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 )
|
||||
{
|
||||
// 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;
|
||||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
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() );
|
||||
|
||||
if( NULL == np )
|
||||
if( nullptr == np )
|
||||
return false;
|
||||
|
||||
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 )
|
||||
{
|
||||
// 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;
|
||||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
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() );
|
||||
|
||||
if( NULL == np )
|
||||
if( nullptr == np )
|
||||
return false;
|
||||
|
||||
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 )
|
||||
{
|
||||
// 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;
|
||||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
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() );
|
||||
|
||||
if( NULL == np )
|
||||
if( nullptr == np )
|
||||
return false;
|
||||
|
||||
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 )
|
||||
{
|
||||
// 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;
|
||||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
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() );
|
||||
|
||||
if( NULL == np )
|
||||
if( nullptr == np )
|
||||
return false;
|
||||
|
||||
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 )
|
||||
{
|
||||
// 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;
|
||||
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
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() );
|
||||
|
||||
if( NULL == np )
|
||||
if( nullptr == np )
|
||||
return false;
|
||||
|
||||
if( !aParent->AddRefNode( np ) )
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,20 +35,18 @@
|
|||
X3DSHAPE::X3DSHAPE() : X3DNODE()
|
||||
{
|
||||
m_Type = X3D_SHAPE;
|
||||
appearance = NULL;
|
||||
geometry = NULL;
|
||||
|
||||
return;
|
||||
appearance = nullptr;
|
||||
geometry = nullptr;
|
||||
}
|
||||
|
||||
|
||||
X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE()
|
||||
{
|
||||
m_Type = X3D_SHAPE;
|
||||
appearance = NULL;
|
||||
geometry = NULL;
|
||||
appearance = nullptr;
|
||||
geometry = nullptr;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES ptype = aParent->GetNodeType();
|
||||
|
||||
|
@ -55,10 +54,8 @@ X3DSHAPE::X3DSHAPE( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Parent = aParent;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,18 +77,16 @@ X3DSHAPE::~X3DSHAPE()
|
|||
|
||||
bool X3DSHAPE::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||
{
|
||||
if( NULL == aTopNode || NULL == aNode )
|
||||
if( nullptr == aTopNode || nullptr == aNode )
|
||||
return false;
|
||||
|
||||
if( NULL != appearance || NULL != geometry )
|
||||
if( nullptr != appearance || nullptr != geometry )
|
||||
return false;
|
||||
|
||||
m_Dict = &aDict;
|
||||
wxXmlAttribute* prop;
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
const wxString& pname = prop->GetName();
|
||||
|
||||
|
@ -102,20 +97,17 @@ bool X3DSHAPE::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
|||
}
|
||||
}
|
||||
|
||||
for( wxXmlNode* child = aNode->GetChildren();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||
{
|
||||
wxString name = child->GetName();
|
||||
|
||||
if( name == "Appearance" && NULL == appearance )
|
||||
if( name == "Appearance" && nullptr == appearance )
|
||||
X3D::ReadAppearance( child, this, aDict );
|
||||
else if( name == "IndexedFaceSet" && NULL == geometry )
|
||||
else if( name == "IndexedFaceSet" && nullptr == geometry )
|
||||
X3D::ReadIndexedFaceSet( child, this, aDict );
|
||||
|
||||
}
|
||||
|
||||
if( NULL == appearance || NULL == geometry )
|
||||
if( nullptr == appearance || nullptr == geometry )
|
||||
return false;
|
||||
|
||||
if( !SetParent( aTopNode ) )
|
||||
|
@ -130,7 +122,7 @@ bool X3DSHAPE::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
if( aParent == m_Parent )
|
||||
return true;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES nt = aParent->GetNodeType();
|
||||
|
||||
|
@ -138,12 +130,12 @@ bool X3DSHAPE::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -152,7 +144,7 @@ bool X3DSHAPE::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
|
||||
bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return false;
|
||||
|
||||
X3DNODES tchild = aNode->GetNodeType();
|
||||
|
@ -173,24 +165,28 @@ bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
|||
|
||||
if( X3D_APPEARANCE == tchild )
|
||||
{
|
||||
if( NULL == appearance )
|
||||
if( nullptr == appearance )
|
||||
{
|
||||
m_Children.push_back( aNode );
|
||||
appearance = aNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( NULL == geometry )
|
||||
if( nullptr == geometry )
|
||||
{
|
||||
m_Children.push_back( aNode );
|
||||
geometry = aNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( aNode->GetParent() != this )
|
||||
aNode->SetParent( this );
|
||||
|
@ -201,7 +197,7 @@ bool X3DSHAPE::AddChildNode( X3DNODE* aNode )
|
|||
|
||||
bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return false;
|
||||
|
||||
X3DNODES tchild = aNode->GetNodeType();
|
||||
|
@ -222,26 +218,30 @@ bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
|||
|
||||
if( X3D_APPEARANCE == tchild )
|
||||
{
|
||||
if( NULL == appearance )
|
||||
if( nullptr == appearance )
|
||||
{
|
||||
m_Refs.push_back( aNode );
|
||||
aNode->addNodeRef( this );
|
||||
appearance = aNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( NULL == geometry )
|
||||
if( nullptr == geometry )
|
||||
{
|
||||
m_Refs.push_back( aNode );
|
||||
aNode->addNodeRef( this );
|
||||
geometry = aNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -249,8 +249,8 @@ bool X3DSHAPE::AddRefNode( X3DNODE* aNode )
|
|||
|
||||
SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
||||
{
|
||||
if( NULL == geometry || NULL == appearance )
|
||||
return NULL;
|
||||
if( nullptr == geometry || nullptr == appearance )
|
||||
return nullptr;
|
||||
|
||||
#if defined( DEBUG_X3D ) && ( DEBUG_X3D > 2 )
|
||||
do {
|
||||
|
@ -264,7 +264,7 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_X3D
|
||||
do {
|
||||
|
@ -276,22 +276,22 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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* pApp = appearance->TranslateToSG( pShape );
|
||||
|
||||
if( NULL == pApp || NULL == pGeom )
|
||||
if( nullptr == pApp || nullptr == pGeom )
|
||||
{
|
||||
if( pGeom )
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
|||
}
|
||||
|
||||
shNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_sgNode = shNode.GetRawPtr();
|
||||
|
@ -332,29 +332,27 @@ SGNODE* X3DSHAPE::TranslateToSG( SGNODE* aParent )
|
|||
|
||||
void X3DSHAPE::unlinkChildNode( const X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode == appearance )
|
||||
appearance = NULL;
|
||||
appearance = nullptr;
|
||||
else if( aNode == geometry )
|
||||
geometry = NULL;
|
||||
geometry = nullptr;
|
||||
|
||||
X3DNODE::unlinkChildNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void X3DSHAPE::unlinkRefNode( const X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return;
|
||||
|
||||
if( aNode == appearance )
|
||||
appearance = NULL;
|
||||
appearance = nullptr;
|
||||
else if( aNode == geometry )
|
||||
geometry = NULL;
|
||||
geometry = nullptr;
|
||||
|
||||
X3DNODE::unlinkRefNode( aNode );
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -44,7 +45,7 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Type = X3D_TRANSFORM;
|
||||
init();
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES ptype = aParent->GetNodeType();
|
||||
|
||||
|
@ -52,7 +53,7 @@ X3DTRANSFORM::X3DTRANSFORM( X3DNODE* aParent ) : X3DNODE()
|
|||
m_Parent = aParent;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return;
|
||||
|
@ -117,9 +118,7 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode )
|
|||
// legacy behavior of 1 X3D unit = 0.1 inch; the SG*
|
||||
// classes expect all units in mm.
|
||||
|
||||
for( prop = aNode->GetAttributes();
|
||||
prop != NULL;
|
||||
prop = prop->GetNext() )
|
||||
for( prop = aNode->GetAttributes(); prop != nullptr; prop = prop->GetNext() )
|
||||
{
|
||||
const wxString& pname = prop->GetName();
|
||||
|
||||
|
@ -134,35 +133,36 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode )
|
|||
center *= 2.54;
|
||||
}
|
||||
else if( pname == "scale" )
|
||||
{
|
||||
X3D::ParseSFVec3( prop->GetValue(), scale );
|
||||
}
|
||||
else if( pname == "translation" )
|
||||
{
|
||||
X3D::ParseSFVec3( prop->GetValue(), translation );
|
||||
translation *= 2.54;
|
||||
}
|
||||
else if( pname == "rotation" )
|
||||
{
|
||||
X3D::ParseSFRotation( prop->GetValue(), rotation );
|
||||
else if( pname == "scaleOrientation" )
|
||||
X3D::ParseSFRotation( prop->GetValue(), scaleOrientation );
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
else if( pname == "scaleOrientation" )
|
||||
{
|
||||
X3D::ParseSFRotation( prop->GetValue(), scaleOrientation );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool X3DTRANSFORM::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
|
||||
{
|
||||
if( NULL == aTopNode || NULL == aNode )
|
||||
if( nullptr == aTopNode || nullptr == aNode )
|
||||
return false;
|
||||
|
||||
m_Dict = &aDict;
|
||||
readFields( aNode );
|
||||
bool ok = false;
|
||||
|
||||
for( wxXmlNode* child = aNode->GetChildren();
|
||||
child != NULL;
|
||||
child = child->GetNext() )
|
||||
for( wxXmlNode* child = aNode->GetChildren(); child != nullptr; child = child->GetNext() )
|
||||
{
|
||||
wxString name = child->GetName();
|
||||
|
||||
|
@ -190,7 +190,7 @@ bool X3DTRANSFORM::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
if( aParent == m_Parent )
|
||||
return true;
|
||||
|
||||
if( NULL != aParent )
|
||||
if( nullptr != aParent )
|
||||
{
|
||||
X3DNODES nt = aParent->GetNodeType();
|
||||
|
||||
|
@ -198,12 +198,12 @@ bool X3DTRANSFORM::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL != m_Parent && doUnlink )
|
||||
if( nullptr != m_Parent && doUnlink )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
m_Parent = aParent;
|
||||
|
||||
if( NULL != m_Parent )
|
||||
if( nullptr != m_Parent )
|
||||
m_Parent->AddChildNode( this );
|
||||
|
||||
return true;
|
||||
|
@ -212,7 +212,7 @@ bool X3DTRANSFORM::SetParent( X3DNODE* aParent, bool doUnlink )
|
|||
|
||||
bool X3DTRANSFORM::AddChildNode( X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return false;
|
||||
|
||||
X3DNODES tchild = aNode->GetNodeType();
|
||||
|
@ -242,7 +242,7 @@ bool X3DTRANSFORM::AddChildNode( X3DNODE* aNode )
|
|||
|
||||
bool X3DTRANSFORM::AddRefNode( X3DNODE* aNode )
|
||||
{
|
||||
if( NULL == aNode )
|
||||
if( nullptr == aNode )
|
||||
return false;
|
||||
|
||||
X3DNODES tchild = aNode->GetNodeType();
|
||||
|
@ -281,11 +281,11 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
|||
#endif
|
||||
|
||||
if( m_Children.empty() && m_Refs.empty() )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
|
||||
|
||||
if( NULL != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
if( nullptr != aParent && ptype != S3D::SGTYPE_TRANSFORM )
|
||||
{
|
||||
#ifdef DEBUG_X3D
|
||||
do {
|
||||
|
@ -297,22 +297,22 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
|||
} while( 0 );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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 ) )
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if( aParent != S3D::GetSGNodeParent( 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_TRANSFORM:
|
||||
|
||||
if( NULL != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
||||
if( nullptr != (*sC)->TranslateToSG( txNode.GetRawPtr() ) )
|
||||
test = true;
|
||||
|
||||
break;
|
||||
|
@ -363,7 +363,7 @@ SGNODE* X3DTRANSFORM::TranslateToSG( SGNODE* aParent )
|
|||
if( false == test )
|
||||
{
|
||||
txNode.Destroy();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
txNode.SetScale( SGPOINT( scale.x, scale.y, scale.z ) );
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,12 +39,12 @@
|
|||
KICAD_PLUGIN_LDR_3D::KICAD_PLUGIN_LDR_3D()
|
||||
{
|
||||
ok = false;
|
||||
m_getNExtensions = NULL;
|
||||
m_getModelExtension = NULL;
|
||||
m_getNFilters = NULL;
|
||||
m_getFileFilter = NULL;
|
||||
m_canRender = NULL;
|
||||
m_load = NULL;
|
||||
m_getNExtensions = nullptr;
|
||||
m_getModelExtension = nullptr;
|
||||
m_getNFilters = nullptr;
|
||||
m_getFileFilter = nullptr;
|
||||
m_canRender = nullptr;
|
||||
m_load = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -244,12 +245,12 @@ void KICAD_PLUGIN_LDR_3D::Close( void )
|
|||
#endif
|
||||
|
||||
ok = false;
|
||||
m_getNExtensions = NULL;
|
||||
m_getModelExtension = NULL;
|
||||
m_getNFilters = NULL;
|
||||
m_getFileFilter = NULL;
|
||||
m_canRender = NULL;
|
||||
m_load = NULL;
|
||||
m_getNExtensions = nullptr;
|
||||
m_getModelExtension = nullptr;
|
||||
m_getNFilters = nullptr;
|
||||
m_getFileFilter = nullptr;
|
||||
m_canRender = nullptr;
|
||||
m_load = nullptr;
|
||||
close();
|
||||
|
||||
return;
|
||||
|
@ -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 )
|
||||
{
|
||||
m_error.clear();
|
||||
|
@ -288,7 +288,7 @@ int KICAD_PLUGIN_LDR_3D::GetNExtensions( void )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if( NULL == m_getNExtensions )
|
||||
if( nullptr == m_getNExtensions )
|
||||
{
|
||||
m_error = "[BUG] GetNExtensions is not linked";
|
||||
|
||||
|
@ -315,10 +315,10 @@ char const* KICAD_PLUGIN_LDR_3D::GetModelExtension( int aIndex )
|
|||
if( m_error.empty() )
|
||||
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";
|
||||
|
||||
|
@ -329,7 +329,7 @@ char const* KICAD_PLUGIN_LDR_3D::GetModelExtension( int aIndex )
|
|||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_getModelExtension( aIndex );
|
||||
|
@ -348,7 +348,7 @@ int KICAD_PLUGIN_LDR_3D::GetNFilters( void )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if( NULL == m_getNFilters )
|
||||
if( nullptr == m_getNFilters )
|
||||
{
|
||||
m_error = "[BUG] GetNFilters is not linked";
|
||||
|
||||
|
@ -375,10 +375,10 @@ char const* KICAD_PLUGIN_LDR_3D::GetFileFilter( int aIndex )
|
|||
if( m_error.empty() )
|
||||
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";
|
||||
|
||||
|
@ -389,7 +389,7 @@ char const* KICAD_PLUGIN_LDR_3D::GetFileFilter( int aIndex )
|
|||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_getFileFilter( aIndex );
|
||||
|
@ -408,7 +408,7 @@ bool KICAD_PLUGIN_LDR_3D::CanRender( void )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL == m_canRender )
|
||||
if( nullptr == m_canRender )
|
||||
{
|
||||
m_error = "[BUG] CanRender is not linked";
|
||||
|
||||
|
@ -435,10 +435,10 @@ SCENEGRAPH* KICAD_PLUGIN_LDR_3D::Load( char const* aFileName )
|
|||
if( m_error.empty() )
|
||||
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";
|
||||
|
||||
|
@ -449,7 +449,7 @@ SCENEGRAPH* KICAD_PLUGIN_LDR_3D::Load( char const* aFileName )
|
|||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_load( aFileName );
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* 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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,11 +35,11 @@
|
|||
KICAD_PLUGIN_LDR::KICAD_PLUGIN_LDR()
|
||||
{
|
||||
ok = false;
|
||||
m_getPluginClass = NULL;
|
||||
m_getClassVersion = NULL;
|
||||
m_checkClassVersion = NULL;
|
||||
m_getPluginName = NULL;
|
||||
m_getVersion = NULL;
|
||||
m_getPluginClass = nullptr;
|
||||
m_getClassVersion = nullptr;
|
||||
m_checkClassVersion = nullptr;
|
||||
m_getPluginName = nullptr;
|
||||
m_getVersion = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -204,7 +205,7 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
|||
if( pclassName )
|
||||
m_error.append( pclassName );
|
||||
else
|
||||
m_error.append( "NULL" );
|
||||
m_error.append( "nullptr" );
|
||||
|
||||
m_error.append( ")" );
|
||||
|
||||
|
@ -259,7 +260,7 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
|||
ostr << " * [INFO] opened plugin " << m_fileName.ToUTF8();
|
||||
char const* cp = m_getPluginName();
|
||||
|
||||
if( NULL != cp )
|
||||
if( nullptr != cp )
|
||||
ostr << " * [INFO] plugin name: '" << cp << "'\n";
|
||||
|
||||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||
|
@ -284,11 +285,11 @@ bool KICAD_PLUGIN_LDR::open( const wxString& aFullFileName, const char* aPluginC
|
|||
void KICAD_PLUGIN_LDR::close( void )
|
||||
{
|
||||
ok = false;
|
||||
m_getPluginClass = NULL;
|
||||
m_getClassVersion = NULL;
|
||||
m_checkClassVersion = NULL;
|
||||
m_getPluginName = NULL;
|
||||
m_getVersion = NULL;
|
||||
m_getPluginClass = nullptr;
|
||||
m_getClassVersion = nullptr;
|
||||
m_checkClassVersion = nullptr;
|
||||
m_getPluginName = nullptr;
|
||||
m_getVersion = nullptr;
|
||||
m_PluginLoader.Unload();
|
||||
|
||||
return;
|
||||
|
@ -323,10 +324,10 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
|
|||
if( m_error.empty() )
|
||||
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";
|
||||
|
||||
|
@ -337,7 +338,7 @@ char const* KICAD_PLUGIN_LDR::GetKicadPluginClass( void )
|
|||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_getPluginClass();
|
||||
|
@ -374,7 +375,7 @@ bool KICAD_PLUGIN_LDR::GetClassVersion( unsigned char* Major, unsigned char* Min
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL == m_checkClassVersion )
|
||||
if( nullptr == m_checkClassVersion )
|
||||
{
|
||||
m_error = "[BUG] CheckClassVersion is not linked";
|
||||
|
||||
|
@ -419,7 +420,7 @@ bool KICAD_PLUGIN_LDR::CheckClassVersion( unsigned char Major, unsigned char Min
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL == m_checkClassVersion )
|
||||
if( nullptr == m_checkClassVersion )
|
||||
{
|
||||
m_error = "[BUG] CheckClassVersion is not linked";
|
||||
|
||||
|
@ -446,10 +447,10 @@ const char* KICAD_PLUGIN_LDR::GetKicadPluginName( void )
|
|||
if( m_error.empty() )
|
||||
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";
|
||||
|
||||
|
@ -460,7 +461,7 @@ const char* KICAD_PLUGIN_LDR::GetKicadPluginName( void )
|
|||
wxLogTrace( MASK_PLUGINLDR, "%s\n", ostr.str().c_str() );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return m_getPluginName();
|
||||
|
@ -480,7 +481,7 @@ bool KICAD_PLUGIN_LDR::GetVersion( unsigned char* Major, unsigned char* Minor,
|
|||
return false;
|
||||
}
|
||||
|
||||
if( NULL == m_getVersion )
|
||||
if( nullptr == m_getVersion )
|
||||
{
|
||||
m_error = "[BUG] GetKicadPluginName is not linked";
|
||||
|
||||
|
|
Loading…
Reference in New Issue