29#include <wx/mstream.h>
31#define BOUNDING_BOX_SCALE_FACTOR 1.3f
41 wxT(
"KI_TRACE_NL_FOOTPRINT_PROPERTIES_PLUGIN" );
59 extents = { min.x, min.y, min.z, max.x, max.y, max.z };
69 if( actions.size() == 0 )
74 using TDx::SpaceMouse::CCommand;
75 using TDx::SpaceMouse::CCommandSet;
78 CCommandSet commandSet(
"EDA_3D_CANVAS",
"3D Viewer" );
81 NAV_3D::PutActiveCommands( commandSet.GetId() );
86 std::vector<TDx::CImage> vImages;
89 categoryStore.insert( categoryStore.end(), CATEGORY_STORE::value_type(
".", &commandSet ) );
91 std::list<TOOL_ACTION*>::const_iterator it;
93 for( it = actions.begin(); it != actions.end(); ++it )
96 std::string label = action->
GetMenuLabel().ToStdString();
106 if(
name.rfind(
"pcbnew.", 0 ) == 0 )
112 if(
name.rfind(
"3DViewer.Control.pivotCenter", 0 ) == 0
113 ||
name.rfind(
"3DViewer.Control.material", 0 ) == 0
114 ||
name.rfind(
"3DViewer.Control.attribute", 0 ) == 0
115 ||
name.rfind(
"3DViewer.Control.show", 0 ) == 0 )
121 CATEGORY_STORE::iterator iter = categoryStore.find( strCategory );
123 if( iter == categoryStore.end() )
125 iter =
add_category( std::move( strCategory ), categoryStore );
131 wxMemoryOutputStream imageStream;
133 if( action->
GetIcon() != BITMAPS::INVALID_BITMAP )
136 image.SaveFile( imageStream, wxBitmapType::wxBITMAP_TYPE_PNG );
139 if( imageStream.GetSize() )
141 wxStreamBuffer* streamBuffer = imageStream.GetOutputStreamBuffer();
142 TDx::CImage tdxImage = TDx::CImage::FromData(
"", 0,
name.c_str() );
143 tdxImage.AssignImage( std::string(
reinterpret_cast<const char*
>(
144 streamBuffer->GetBufferStart() ),
145 streamBuffer->GetBufferSize() ),
149 vImages.push_back( std::move( tdxImage ) );
153 wxLogTrace(
m_logTrace, wxT(
"Inserting command: %s, description: %s, in category: %s" ),
154 name, description, iter->first );
156 iter->second->push_back(
157 CCommand( std::move(
name ), std::move( label ), std::move( description ) ) );
160 NAV_3D::AddCommandSet( commandSet );
161 NAV_3D::AddImages( vImages );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
static std::list< TOOL_ACTION * > & GetActionList()
Return list of TOOL_ACTIONs.
const BBOX_3D & GetBBox() const noexcept
Get the board outling bounding box.
Implement a canvas based on a wxGLCanvas.
const BOARD_ADAPTER & GetBoardAdapter() const
Get information used to display 3D board.
The class that implements the accessors and mutators required for 3D navigation in an EDA_3D_CANVAS u...
EDA_3D_CANVAS * GetCanvas() const
Get the m_canvas pointer.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
CATEGORY_STORE::iterator add_category(std::string aCategoryPath, CATEGORY_STORE &aCategoryStore)
Add a category to the store.
std::map< std::string, TDx::CCommandTreeNode * > CATEGORY_STORE
const SFVEC3F & Min() const
Return the minimum vertex pointer.
const SFVEC3F & Max() const
Return the maximum vertex pointer.