X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FDRAWEXE%2FDRAWEXE.cxx;h=0f4a2f2312fd6b8d70ed990c2ab56a8f646d0a7d;hb=977d3d479e1693a45983915410edac88d0b29a8d;hpb=b04cd5d58770c45bea62f120000343b140415387 diff --git a/src/DRAWEXE/DRAWEXE.cxx b/src/DRAWEXE/DRAWEXE.cxx index 4e3e7f4c66..0f4a2f2312 100644 --- a/src/DRAWEXE/DRAWEXE.cxx +++ b/src/DRAWEXE/DRAWEXE.cxx @@ -18,6 +18,8 @@ #include #include #include +#include +#include #ifdef OCCT_NO_PLUGINS #include @@ -31,12 +33,124 @@ #include #endif +#ifdef OCCT_NO_PLUGINS +//! Mimic pload command by loading pre-defined set of statically linked plugins. +static Standard_Integer Pload (Draw_Interpretor& theDI, + Standard_Integer theNbArgs, + const char** theArgVec) +{ + NCollection_IndexedMap aPlugins; + for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter) + { + TCollection_AsciiString anArg (theArgVec[anArgIter]); + anArg.UpperCase(); + if (anArg == "DEFAULT") + { + aPlugins.Add ("TOPTEST"); + } + else if (anArg == "MODELING") + { + aPlugins.Add ("TOPTEST"); + } + else if (anArg == "VISUALIZATION") + { + aPlugins.Add ("AISV"); + } + else if (anArg == "OCAFKERNEL") + { + aPlugins.Add ("DCAF"); + } + else if (anArg == "DATAEXCHANGEKERNEL") + { + aPlugins.Add ("XSDRAW"); + } + else if (anArg == "OCAF") + { + aPlugins.Add ("AISV"); + aPlugins.Add ("DCAF"); + } + else if (anArg == "DATAEXCHANGE") + { + aPlugins.Add ("XSDRAW"); + aPlugins.Add ("XDEDRAW"); + aPlugins.Add ("AISV"); + } + else if (anArg == "XDE") + { + aPlugins.Add ("XSDRAW"); + aPlugins.Add ("XDEDRAW"); + } + else if (anArg == "ALL") + { + aPlugins.Add ("TOPTEST"); + aPlugins.Add ("DCAF"); + aPlugins.Add ("XSDRAW"); + aPlugins.Add ("XDEDRAW"); + aPlugins.Add ("AISV"); + } + else + { + aPlugins.Add (anArg); + } + } + + for (NCollection_IndexedMap::Iterator aPluginIter (aPlugins); + aPluginIter.More(); aPluginIter.Next()) + { + const TCollection_AsciiString& aPlugin = aPluginIter.Value(); + if (aPlugin == "TOPTEST") + { + BOPTest::Factory (theDI); + } + else if (aPlugin == "DCAF") + { + DPrsStd::Factory (theDI); + } + else if (aPlugin == "AISV") + { + ViewerTest::Factory (theDI); + } + #if defined(HAVE_OPENGL) + else if (aPlugin == "GL" + || aPlugin == "OPENGL") + { + OpenGlTest::Factory (theDI); + } + #endif + #if defined(HAVE_GLES2) + else if (aPlugin == "GLES" + || aPlugin == "OPENGLES") + { + OpenGlTest::Factory (theDI); + } + #endif + else if (aPlugin == "XSDRAW") + { + XSDRAWSTLVRML::Factory (theDI); + } + else if (aPlugin == "XDEDRAW") + { + XDEDRAW::Factory (theDI); + } + //else if (aPlugin == "TOBJ") { TObjDRAW::Factory (theDI); } + //else if (aPlugin == "QACOMMANDS") { QADraw::Factory (theDI); } + else + { + theDI << "Error: unknown plugin '" << aPlugin << "'"; + return 1; + } + } + + return 0; +} +#endif + //======================================================================= //function : Draw_InitAppli //purpose : //======================================================================= -void Draw_InitAppli (Draw_Interpretor& di) +void Draw_InitAppli (Draw_Interpretor& theDI) { #if defined(__EMSCRIPTEN__) // open JavaScript console within the Browser to see this output @@ -44,22 +158,13 @@ void Draw_InitAppli (Draw_Interpretor& di) Message::DefaultMessenger()->AddPrinter (aJSConsolePrinter); #endif - Draw::Commands (di); - DBRep::BasicCommands (di); - DrawTrSurf::BasicCommands (di); + Draw::Commands (theDI); + DBRep::BasicCommands (theDI); + DrawTrSurf::BasicCommands (theDI); #ifdef OCCT_NO_PLUGINS - // load a couple of plugins - BOPTest::Factory (di); - DPrsStd::Factory (di); - XSDRAWSTLVRML::Factory (di); - XDEDRAW::Factory (di); - #if defined(HAVE_OPENGL) || defined(HAVE_GLES2) - ViewerTest::Factory (di); - OpenGlTest::Factory (di); - #endif - //TObjDRAW::Factory (di); - //QADraw::Factory (di); + theDI.Add ("pload" , "pload [[Key1] [Key2] ...]: Loads Draw plugins", + __FILE__, Pload, "Draw Plugin"); #endif }