myGroupId = "";
myWorkbenchId = "";
+ myPluginLibrary = "";
+
+ myInternal = false;
+ myUseInput = false;
+ myNestedFeatures = "";
}
const std::string& Config_FeatureMessage::icon() const
return myUseInput;
}
+bool Config_FeatureMessage::isInternal() const
+{
+ return myInternal;
+}
+
void Config_FeatureMessage::setUseInput(bool isUseInput)
{
myUseInput = isUseInput;
}
+void Config_FeatureMessage::setInternal(bool isInternal)
+{
+ myInternal = isInternal;
+}
+
const std::string& Config_FeatureMessage::nestedFeatures() const
{
return myNestedFeatures;
std::string myPluginLibrary; //Name of feature's library\r
\r
bool myUseInput; //Action is being checked until user commit the operation\r
+ bool myInternal; //Internal feature without GUI representation\r
std::string myNestedFeatures;\r
\r
public:\r
CONFIG_EXPORT const std::string& pluginLibrary() const;\r
CONFIG_EXPORT const std::string& nestedFeatures() const;\r
CONFIG_EXPORT bool isUseInput() const;\r
+ CONFIG_EXPORT bool isInternal() const;\r
\r
CONFIG_EXPORT void setIcon(const std::string& icon);\r
CONFIG_EXPORT void setId(const std::string& id);\r
CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary);\r
CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures);\r
CONFIG_EXPORT void setUseInput(bool isUseInput);\r
+ CONFIG_EXPORT void setInternal(bool isInternal);\r
};\r
\r
#endif // CONFIG_MESSAGE_H\r
#include <libxml/xmlstring.h>
#include <string>
+#include <algorithm>
#ifdef _DEBUG
#include <iostream>
void Config_FeatureReader::fillFeature(xmlNodePtr theRoot, Config_FeatureMessage& outFtMessage)
{
outFtMessage.setId(getProperty(theRoot, _ID));
+ outFtMessage.setPluginLibrary(myLibraryName);
+ outFtMessage.setNestedFeatures(getProperty(theRoot, FEATURE_NESTED));
+ bool isFtInternal = isInternalFeature(theRoot);
+ outFtMessage.setInternal(isFtInternal);
+ if(isFtInternal) {
+ //Internal feature has no visual representation.
+ return;
+ }
outFtMessage.setText(getProperty(theRoot, FEATURE_TEXT));
outFtMessage.setTooltip(getProperty(theRoot, FEATURE_TOOLTIP));
outFtMessage.setIcon(getProperty(theRoot, FEATURE_ICON));
outFtMessage.setKeysequence(getProperty(theRoot, FEATURE_KEYSEQUENCE));
outFtMessage.setGroupId(myLastGroup);
outFtMessage.setWorkbenchId(myLastWorkbench);
- outFtMessage.setPluginLibrary(myLibraryName);
- outFtMessage.setNestedFeatures(getProperty(theRoot, FEATURE_NESTED));
+}
+
+bool Config_FeatureReader::isInternalFeature(xmlNodePtr theRoot)
+{
+ std::string prop = getProperty(theRoot, FEATURE_INTERNAL);
+ std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
+ if(prop.empty() || prop == "false" || prop == "0") {
+ return false;
+ }
+ return true;
}
bool processChildren(xmlNodePtr aNode);
void fillFeature(xmlNodePtr theRoot, Config_FeatureMessage& outFeatureMessage);
+ bool isInternalFeature(xmlNodePtr theRoot);
private:
std::string myLastWorkbench;
const static char* FEATURE_ICON = "icon";
const static char* FEATURE_KEYSEQUENCE = "keysequence";
const static char* FEATURE_NESTED = "nested";
+const static char* FEATURE_INTERNAL = "internal";
const static char* SOURCE_FILE = "path";
void Config_ModuleReader::loadLibrary(const std::string theLibName)
{
-#ifdef _DEBUG
- std::cout << "Config_ModuleReader::loading library... " << theLibName.c_str() << std::endl;
-#endif
std::string aFileName = library(theLibName);
if (aFileName.empty())
return;
<feature id="Point" text="Point" tooltip="Create a new point" icon=":icons/point.png">
<source path="point_widget.xml"/>
</feature>
- <feature id="Axis" text="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence=""/>
- <feature id="Plane" text="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence=""/>
+ <feature id="Axis" text="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence="" internal="true"/>
+ <feature id="Plane" text="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence="" internal="true"/>
</group>
</workbench>
</plugin>
boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
{
if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
- #ifdef _DEBUG
- std::cout << "ModelAPI_PluginManager::get: " << "Model library has not been loaded from xml." << std::endl;
- #endif
Config_ModuleReader::loadLibrary("Model");
}
return MY_MANAGER;
<label text="Select a plane on which to create a sketch" tooltip="Select a plane on which to create a sketch"/>
<!--icon=":pictures/x_point.png"-->
</feature>
- <feature id="SketchPoint" text="Point" tooltip="Create a new point" icon=":icons/point.png" />
+ <feature id="SketchPoint" text="Point" tooltip="Create a new point" icon=":icons/point.png"/>
<feature id="SketchLine" text="Line" tooltip="Create a new line" icon=":icons/line.png">
<point_selector id="StartPoint" title="Start point" tooltip="Start point of the line"/>
<point_selector id="EndPoint" title="End point" tooltip="End point of the line"/>
</feature>
- <feature id="SketchConstraintCoincidence" text="Points coincidence" tooltip="Create constraint for the coincidence of two points" icon="" />
+ <feature id="SketchConstraintCoincidence" text="Points coincidence" tooltip="Create constraint for the coincidence of two points" internal="1"/>
</group>
</workbench>
</plugin>
static Events_ID aFeatureLoadedId = Events_Loop::loop()->eventByName(EVENT_FEATURE_LOADED);
if (theMessage->eventID() == aFeatureLoadedId) {
const Config_FeatureMessage* aFeatureMsg = dynamic_cast<const Config_FeatureMessage*>(theMessage);
- addFeature(aFeatureMsg);
+ if(!aFeatureMsg->isInternal()) {
+ addFeature(aFeatureMsg);
+ }
return;
}
//Update property panel on corresponding message. If there is no current operation (no