44#include <wx/mstream.h> 
   58        CNavigation3D( false, false ),
 
   65    PutProfileHint( 
"KiCAD PCB" );
 
   69    EnableNavigation( 
true );
 
   72    PutFrameTimingSource( TimingSource::SpaceMouse );
 
 
   80    EnableNavigation( 
false );
 
 
   86    wxLogTrace( 
m_logTrace, wxT( 
"NL_PCBNEW_PLUGIN_IMPL::SetFocus %d" ), aFocus );
 
   87    NAV_3D::Write( navlib::focus_k, aFocus );
 
 
  103    using TDx::SpaceMouse::CCategory;
 
  105    CATEGORY_STORE::iterator parent_iter = aCategoryStore.begin();
 
  106    std::string::size_type   pos = aCategoryPath.find_last_of( 
'.' );
 
  108    if( pos != std::string::npos )
 
  110        std::string parentPath = aCategoryPath.substr( 0, pos );
 
  111        parent_iter = aCategoryStore.find( parentPath );
 
  113        if( parent_iter == aCategoryStore.end() )
 
  116            parent_iter = aCategoryStore.find( parentPath );
 
  120    std::string 
name = aCategoryPath.substr( pos + 1 );
 
  121    auto        categoryNode = std::make_unique<CCategory>( aCategoryPath.c_str(), 
name.c_str() );
 
  123    aCategoryStore.insert( aCategoryStore.end(), { aCategoryPath, categoryNode.get() } );
 
  125    if( parent_iter != aCategoryStore.end() )
 
  126        parent_iter->second->push_back( std::move( categoryNode ) );
 
 
  132    wxLogTrace( 
m_logTrace, wxT( 
"NL_PCBNEW_PLUGIN_IMPL::exportCommandsAndImages" ) );
 
  136    if( actions.size() == 0 )
 
  139    using TDx::SpaceMouse::CCommand;
 
  140    using TDx::SpaceMouse::CCommandSet;
 
  143    CCommandSet commandSet( 
"PCB_DRAW_PANEL_GAL", 
"PCB Viewer" );
 
  146    NAV_3D::PutActiveCommands( commandSet.GetId() );
 
  151    std::vector<TDx::CImage> vImages;
 
  154    categoryStore.insert( categoryStore.end(), CATEGORY_STORE::value_type( 
".", &commandSet ) );
 
  156    std::list<TOOL_ACTION*>::const_iterator it;
 
  158    for( it = actions.begin(); it != actions.end(); ++it )
 
  161        std::string        label = action->
GetMenuLabel().ToStdString();
 
  170        if( 
name.rfind( 
"3DViewer.", 0 ) == 0 )
 
  174        CATEGORY_STORE::iterator iter = categoryStore.find( strCategory );
 
  176        if( iter == categoryStore.end() )
 
  179            iter = categoryStore.find( strCategory );
 
  185        wxMemoryOutputStream imageStream;
 
  190            image.SaveFile( imageStream, wxBitmapType::wxBITMAP_TYPE_PNG );
 
  193            if( imageStream.GetSize() )
 
  195                wxStreamBuffer* streamBuffer = imageStream.GetOutputStreamBuffer();
 
  196                TDx::CImage     tdxImage = TDx::CImage::FromData( 
"", 0, 
name.c_str() );
 
  197                tdxImage.AssignImage( std::string( 
reinterpret_cast<const char*
>(
 
  198                                                           streamBuffer->GetBufferStart() ),
 
  199                                                   streamBuffer->GetBufferSize() ),
 
  203                vImages.push_back( std::move( tdxImage ) );
 
  207        if( iter != categoryStore.end() )
 
  209            wxLogTrace( 
m_logTrace, wxT( 
"Inserting command: %s,  description: %s,  in category:  %s" ),
 
  210                        name, description, iter->first );
 
  212            iter->second->push_back( CCommand( 
name, label, description ) );
 
  216    NAV_3D::AddCommandSet( commandSet );
 
  217    NAV_3D::AddImages( vImages );
 
 
  224        return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
  228    double x = 
m_view->IsMirroredX() ? -1 : 1;
 
  229    double y = 
m_view->IsMirroredY() ? 1 : -1;
 
  236    matrix = { { { x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 
m_viewPosition.x, 
m_viewPosition.y, 0, 1 } } };
 
 
  244        return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
  248    position.x = mouse_pointer.
x;
 
  249    position.y = mouse_pointer.
y;
 
 
  259        return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
  266    extents.min_x = -box.
GetWidth() / 2.0;
 
  269    extents.max_x = box.
GetWidth() / 2.0;
 
 
  288        return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
  291    VECTOR2D viewPos( matrix.m4x4[3][0], matrix.m4x4[3][1] );
 
  296        result = navlib::make_result_code( navlib::navlib_errc::error );
 
  300        m_view->SetCenter( viewPos );
 
 
  312        return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
  317        result = navlib::make_result_code( navlib::navlib_errc::error );
 
  326        result = navlib::make_result_code( navlib::navlib_errc::error );
 
 
  334    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  340    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  347        return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
  352    double half_depth = 0.1 / 
m_viewport2D->GetGAL()->GetWorldScale();
 
  357    extents.min_x = 
static_cast<double>( box.
GetOrigin().x );
 
  358    extents.min_y = 
static_cast<double>( box.
GetOrigin().y );
 
  359    extents.min_z = -half_depth;
 
  360    extents.max_x = 
static_cast<double>( box.
GetEnd().x );
 
  361    extents.max_y = 
static_cast<double>( box.
GetEnd().y );
 
  362    extents.max_z = half_depth;
 
 
  371    matrix = { { { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1 } } };
 
 
  378    matrix = { { { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1 } } };
 
 
  399    if( commandId.empty() )
 
  405    for( std::list<TOOL_ACTION*>::const_iterator it = actions.begin(); it != actions.end(); it++ )
 
  408        std::string  nm = action->
GetName();
 
  410        if( commandId == nm )
 
  420        if( parent && parent->IsEnabled() )
 
  427                return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
  432            bool runAction = 
true;
 
  435                runAction = aCond->enableCondition( sel );
 
  442            return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  475    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  481    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  487    return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
 
  493    return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
 
  499    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  505    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  511    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  517    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  523    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  529    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  535    return navlib::make_result_code( navlib::navlib_errc::no_data_available );
 
 
  541    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  547    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  553    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  559    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
  565    return navlib::make_result_code( navlib::navlib_errc::invalid_operation );
 
 
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
 
const ACTION_CONDITIONS * GetCondition(const TOOL_ACTION &aAction) const
Get the conditions to use for a specific tool action.
 
static std::list< TOOL_ACTION * > & GetActionList()
Return list of TOOL_ACTIONs.
 
constexpr const Vec GetEnd() const
 
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
 
constexpr size_type GetWidth() const
 
constexpr size_type GetHeight() const
 
constexpr const Vec & GetOrigin() const
 
virtual ~NL_PCBNEW_PLUGIN_IMPL()
 
long GetIsViewRotatable(navlib::bool_t &isRotatable) const override
 
long SetCameraMatrix(const navlib::matrix_t &aMatrix) override
 
long GetPivotVisible(navlib::bool_t &aVisible) const override
 
long GetPointerPosition(navlib::point_t &aPosition) const override
 
long SetHitLookFrom(const navlib::point_t &aPosition) override
 
long GetFrontView(navlib::matrix_t &aMatrix) const override
 
long SetHitSelectionOnly(bool aSelectionOnly) override
 
long SetViewFOV(double aFov) override
 
long GetViewFOV(double &aFov) const override
 
long IsUserPivot(navlib::bool_t &aUserPivot) const override
 
long SetSettingsChanged(long aChangeNumber) override
 
void SetFocus(bool aFocus)
Set the connection to the 3Dconnexion driver to the focus state so that 3DMouse data is routed here.
 
long SetTransaction(long aValue) override
 
long GetViewExtents(navlib::box_t &aExtents) const override
 
long GetPivotPosition(navlib::point_t &aPosition) const override
 
long GetCoordinateSystem(navlib::matrix_t &aMatrix) const override
 
long SetPivotVisible(bool aVisible) override
 
long SetPivotPosition(const navlib::point_t &aPosition) override
 
long GetIsViewPerspective(navlib::bool_t &aPerspective) const override
 
NL_PCBNEW_PLUGIN_IMPL(PCB_DRAW_PANEL_GAL *aViewport)
Initializes a new instance of the NL_PCBNEW_PLUGIN_IMPL.
 
long GetHitLookAt(navlib::point_t &aPosition) const override
 
long GetSelectionTransform(navlib::matrix_t &aTransform) const override
 
long SetViewExtents(const navlib::box_t &aExtents) override
 
void exportCommandsAndImages()
Export the invocable actions and images to the 3Dconnexion UI.
 
long SetCameraTarget(const navlib::point_t &aPosition) override
 
long GetCameraMatrix(navlib::matrix_t &aMatrix) const override
 
long SetMotionFlag(bool aValue) override
 
long GetViewFrustum(navlib::frustum_t &aFrustum) const override
 
long GetModelExtents(navlib::box_t &aExtents) const override
 
long SetViewFrustum(const navlib::frustum_t &aFrustum) override
 
long GetSelectionExtents(navlib::box_t &aExtents) const override
 
long SetSelectionTransform(const navlib::matrix_t &aMatrix) override
 
PCB_DRAW_PANEL_GAL * m_viewport2D
 
long SetHitAperture(double aAperture) override
 
long SetHitDirection(const navlib::vector_t &aDirection) override
 
long GetIsSelectionEmpty(navlib::bool_t &aEmpty) const override
 
long SetActiveCommand(std::string aCommandId) override
 
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
 
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
 
static bool empty(const wxTextEntryBase *aCtrl)
 
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
 
bool equals(glm::mat< L, C, T, Q > const &aFirst, glm::mat< L, C, T, Q > const &aSecond, T aEpsilon=static_cast< T >(FLT_EPSILON *10))
Template to compare two glm::mat<T> values for equality within a required epsilon.
 
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
 
static void add_category(const std::string &aCategoryPath, CATEGORY_STORE &aCategoryStore)
Add a category to the store.
 
Declaration of the NL_PCBNEW_PLUGIN_IMPL class.
 
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
 
wxString result
Test unit parsing edge cases and error handling.
 
VECTOR2< double > VECTOR2D
 
WX_VIEW_CONTROLS class definition.