ADD_SUBDIRECTORY (src/ModelAPI)
ADD_SUBDIRECTORY (src/GeomAPI)
ADD_SUBDIRECTORY (src/GeomAlgoAPI)
+ADD_SUBDIRECTORY (src/GeomData)
+ADD_SUBDIRECTORY (src/GeomDataAPI)
ADD_SUBDIRECTORY (src/PartSetPlugin)
ADD_SUBDIRECTORY (src/ConstructionPlugin)
ADD_SUBDIRECTORY (src/SketchPlugin)
{
}
+std::list<std::string> Config_FeatureReader::features() const
+{
+ return myFeatures;
+}
+
void Config_FeatureReader::processNode(xmlNodePtr theNode)
{
Events_ID aMenuItemEvent = Events_Loop::eventByName(myEventGenerated);
Events_Loop* aEvLoop = Events_Loop::loop();
Config_FeatureMessage aMessage(aMenuItemEvent, this);
fillFeature(theNode, aMessage);
+ myFeatures.push_back(getProperty(theNode, _ID));
//If a feature has xml definition for it's widget:
aMessage.setUseInput(hasChild(theNode));
aEvLoop->send(aMessage);
if (isNode(theNode, NODE_WORKBENCH, NULL)) {
myLastWorkbench = getProperty(theNode, _ID);
}
+ //Process SOURCE nodes.
+ Config_XMLReader::processNode(theNode);
}
bool Config_FeatureReader::processChildren(xmlNodePtr theNode)
#include <Config_XMLReader.h>
#include <string>
-
+#include <list>
class Config_FeatureMessage;
{
public:
Config_FeatureReader(const std::string& theXmlFile,
- const std::string& theLibraryName = "",
+ const std::string& theLibraryName,
const char* theEventGenerated = 0);
virtual ~Config_FeatureReader();
+ std::list<std::string> features() const;
+
protected:
void processNode(xmlNodePtr aNode);
bool processChildren(xmlNodePtr aNode);
std::string myLastWorkbench;
std::string myLastGroup;
std::string myLibraryName;
+
+ std::list<std::string> myFeatures;
/// event generated on feature data sending, by default it is "FeatureEvent"
const char* myEventGenerated;
};
const static char* NODE_WORKBENCH = "workbench";
const static char* NODE_GROUP = "group";
const static char* NODE_FEATURE = "feature";
+const static char* NODE_SOURCE = "source";
+
//Widgets
const static char* WDG_DOUBLEVALUE = "doublevalue";
//Widget containers
const static char* WDG_SWITCH = "switch";
const static char* WDG_SWITCH_CASE = "case";
-
const static char* _ID = "id";
//const static char* WORKBENCH_ID = "id";
//const static char* GROUP_ID = "id";
const static char* FEATURE_TOOLTIP = "tooltip";
const static char* FEATURE_ICON = "icon";
const static char* FEATURE_KEYSEQUENCE = "keysequence";
+const static char* SOURCE_FILE = "path";
+
// doublevalue properties:
const static char* DOUBLE_WDG_MIN = "min";
Config_ModuleReader::Config_ModuleReader(const char* theEventGenerated)
- : Config_XMLReader("plugins.xml"), myIsAutoImport(false), myEventGenerated(theEventGenerated)
+ : Config_XMLReader("plugins.xml"),
+ myEventGenerated(theEventGenerated)
{
}
{
}
+const std::map<std::string, std::string>& Config_ModuleReader::featuresInFiles() const
+{
+ return myFeaturesInFiles;
+}
+
/*
* Get module name from plugins.xml
* (property "module")
if (isNode(theNode, NODE_PLUGIN, NULL)) {
std::string aPluginConf = getProperty(theNode, PLUGIN_CONFIG);
std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY);
- if (myIsAutoImport)
- importPlugin(aPluginConf, aPluginLibrary);
- myPluginsMap[aPluginLibrary] = aPluginConf;
+ std::list<std::string> aFeatures = importPlugin(aPluginConf, aPluginLibrary);
+ std::list<std::string>::iterator it = aFeatures.begin();
+ for( ; it != aFeatures.end(); it++ ) {
+ myFeaturesInFiles[*it] = aPluginConf;
+ }
}
}
return isNode(theNode, NODE_PLUGINS, NULL);
}
-void Config_ModuleReader::importPlugin(const std::string& thePluginName,
- const std::string& thePluginLibrary)
+std::list<std::string>
+Config_ModuleReader::importPlugin(const std::string& thePluginFile,
+ const std::string& thePluginLibrary)
{
- Config_FeatureReader* aReader;
- if(thePluginLibrary.empty()) {
- aReader = new Config_FeatureReader(thePluginName);
- } else {
- aReader = new Config_FeatureReader(thePluginName, thePluginLibrary, myEventGenerated);
- }
- aReader->readAll();
+ Config_FeatureReader aReader = Config_FeatureReader(thePluginFile,
+ thePluginLibrary,
+ myEventGenerated);
+ aReader.readAll();
+ return aReader.features();
}
-void Config_ModuleReader::setAutoImport(bool theEnabled)
-{
- myIsAutoImport = theEnabled;
-}
-
-const std::map<std::string, std::string>& Config_ModuleReader::plugins() const
-{
- return myPluginsMap;
-}
#include <Config_XMLReader.h>
#include <map>
+#include <list>
#include <string>
CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0);
CONFIG_EXPORT virtual ~Config_ModuleReader();
- CONFIG_EXPORT void setAutoImport(bool enabled);
- CONFIG_EXPORT const std::map<std::string, std::string>& plugins() const;
+ CONFIG_EXPORT const std::map<std::string, std::string>& featuresInFiles() const;
CONFIG_EXPORT std::string getModuleName();
void processNode(xmlNodePtr aNode);
bool processChildren(xmlNodePtr aNode);
- void importPlugin(const std::string& thePluginName,
- const std::string& thePluginLibrary = "");
+ std::list<std::string> importPlugin(const std::string& thePluginFile,
+ const std::string& thePluginLibrary);
private:
- bool myIsAutoImport;
- std::map<std::string, std::string> myPluginsMap;
+ std::map<std::string, std::string> myFeaturesInFiles;
const char* myEventGenerated;
};
return myDescriptionCache[theFeatureName];
}
+
void Config_WidgetReader::processNode(xmlNodePtr theNode)
{
if (isNode(theNode, NODE_FEATURE, NULL)) {
- std::string result = "";
std::string aNodeName = getProperty(theNode, _ID);
- if (hasChild(theNode)) {
- xmlBufferPtr buffer = xmlBufferCreate();
- int size = xmlNodeDump(buffer, theNode->doc, theNode, 0, 1);
- result = std::string((char*) buffer->content);
- }
- myWidgetCache[aNodeName] = result;
+ myWidgetCache[aNodeName] = dumpNode(theNode);;
myDescriptionCache[aNodeName] = getProperty(theNode, FEATURE_TEXT);
}
+ //Process SOURCE nodes.
+ Config_XMLReader::processNode(theNode);
}
bool Config_WidgetReader::processChildren(xmlNodePtr theNode)
{
return isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NULL);
}
+
+std::string Config_WidgetReader::dumpNode(xmlNodePtr theNode)
+{
+ std::string result = "";
+ if (!hasChild(theNode)) {
+ return result;
+ }
+ xmlNodePtr aChildrenNode = xmlFirstElementChild(theNode);
+ xmlBufferPtr buffer = xmlBufferCreate();
+ if (isNode(aChildrenNode, NODE_SOURCE, NULL)) {
+ Config_XMLReader aSourceReader =
+ Config_XMLReader(getProperty(aChildrenNode, SOURCE_FILE));
+ xmlNodePtr aSourceRoot = aSourceReader.findRoot();
+ int size = xmlNodeDump(buffer, aSourceRoot->doc, aSourceRoot, 0, 1);
+ } else {
+ int size = xmlNodeDump(buffer, theNode->doc, theNode, 0, 1);
+ }
+ result = std::string((char*) (buffer->content));
+ return result;
+}
protected:
void processNode(xmlNodePtr theNode);
bool processChildren(xmlNodePtr theNode);
+ std::string dumpNode(xmlNodePtr theNode);
private:
std::map<std::string, std::string> myWidgetCache;
*/
#include <Config_XMLReader.h>
+#include <Config_Keywords.h>
+#include <Config_Common.h>
#include <Events_Loop.h>
#include <libxml/parser.h>
* The default impl does nothing. (In debug mode prints
* some info)
*/
-void Config_XMLReader::processNode(xmlNodePtr aNode)
+void Config_XMLReader::processNode(xmlNodePtr theNode)
{
-#ifdef _DEBUG
- std::cout << "Config_XMLReader::processNode: "
- << aNode->name << " content: "
- << aNode->content << std::endl;
-#endif
+ if (isNode(theNode, NODE_SOURCE, NULL)) {
+ std::string aSourceFile = getProperty(theNode, SOURCE_FILE);
+ Config_XMLReader aSourceReader = Config_XMLReader(aSourceFile);
+ readRecursively(aSourceReader.findRoot());
+ #ifdef _DEBUG
+ std::cout << "Config_XMLReader::sourced node: " << aSourceFile << std::endl;
+ #endif
+ }
}
/*
#endif
return NULL;
}
-
xmlNodePtr aRoot = xmlDocGetRootElement(myXmlDoc);
#ifdef _DEBUG
if(aRoot == NULL) {
CONFIG_EXPORT void readAll();
+public:
+ CONFIG_EXPORT xmlNodePtr findRoot();
+
protected:
virtual void processNode(xmlNodePtr aNode);
virtual bool processChildren(xmlNodePtr aNode);
- xmlNodePtr findRoot();
void readRecursively(xmlNodePtr theParent);
xmlNodePtr node(void* theNode);
SET(XML_RESOURCES
plugin-Construction.xml
+ point_widget.xml
)
INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
<workbench id="Construction">
<group id="Basic">
<feature id="Point" text="Point" tooltip="Create a new point" icon=":icons/point.png">
- <doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X"/>
- <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
- <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
+ <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=""/>
--- /dev/null
+<source>
+ <doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X"/>
+ <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
+ <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
+</source>
const gp_Dir& aDir = impl<gp_Pln>().Axis().Direction();
return boost::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
}
+
+void GeomAPI_Pln::coefficients(double& theA, double& theB, double& theC, double& theD)
+{
+ impl<gp_Pln>().Coefficients(theA, theB, theC, theD);
+}
GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
const boost::shared_ptr<GeomAPI_Dir>& theNormal);
- /// Creation of plane by coefficients A * X + B * Y + C * Z + D = 0.0
+ /// Creation of plane by coefficients (Ax+By+Cz+D=0)
GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD);
/// Returns a point of this plane
/// Returns a plane normal
boost::shared_ptr<GeomAPI_Dir> direction();
+
+ /// Returns the plane coefficients (Ax+By+Cz+D=0)
+ void coefficients(double& theA, double& theB, double& theC, double& theD);
};
#endif
)
SET(SWIG_LINK_LIBRARIES
+ GeomAPI
GeomAlgoAPI
${PYTHON_LIBRARIES}
)
#include <gp_Pln.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <TopoDS_Face.hxx>
+#include <TopoDS.hxx>
+#include <BRep_Tool.hxx>
+#include <Geom_Plane.hxx>
boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
aRes->setImpl(new TopoDS_Shape(aFaceBuilder.Face()));
return aRes;
}
+
+boost::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
+ boost::shared_ptr<GeomAPI_Shape> theFace)
+{
+ boost::shared_ptr<GeomAPI_Pln> aResult;
+ if (!theFace) return aResult; // bad shape
+ TopoDS_Shape aShape = theFace->impl<TopoDS_Shape>();
+ if (aShape.IsNull()) return aResult; // null shape
+ TopoDS_Face aFace = TopoDS::Face(aShape);
+ if (aFace.IsNull()) return aResult; // not face
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ if (aSurf.IsNull()) return aResult; // no surface
+ Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurf);
+ if (aPlane.IsNull()) return aResult; // not planar
+ double aA, aB, aC, aD;
+ aPlane->Coefficients(aA, aB, aC, aD);
+ aResult = boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
+ return aResult;
+}
#include <GeomAlgoAPI.h>
#include <GeomAPI_Shape.h>
#include <GeomAPI_Pnt.h>
+#include <GeomAPI_Pln.h>
#include <GeomAPI_Dir.h>
#include <boost/shared_ptr.hpp>
/// normal to the plane and size of square
static boost::shared_ptr<GeomAPI_Shape> square(boost::shared_ptr<GeomAPI_Pnt> theCenter,
boost::shared_ptr<GeomAPI_Dir> theNormal, const double theSize);
+
+ /// Returns the plane of the planar face. If it is not planar, returns empty ptr.
+ static boost::shared_ptr<GeomAPI_Pln> plane(boost::shared_ptr<GeomAPI_Shape> theFace);
};
#endif
--- /dev/null
+INCLUDE(Common)
+INCLUDE(FindCAS)
+
+SET(PROJECT_HEADERS
+ GeomData.h
+ GeomData_Point.h
+)
+
+SET(PROJECT_SOURCES
+ GeomData_Point.cpp
+)
+
+ADD_DEFINITIONS(-DGEOMDATA_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
+ADD_LIBRARY(GeomData SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(GeomData ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Events Config)
+
+INCLUDE_DIRECTORIES(
+ ../ModelAPI
+ ../GeomDataAPI
+ ../Events
+ ../Config
+ ${CAS_INCLUDE_DIRS}
+)
+
+INSTALL(TARGETS GeomData DESTINATION bin)
--- /dev/null
+#ifndef GEOMDATA_H
+#define GEOMDATA_H
+
+#if defined GEOMDATA_EXPORTS
+#if defined WIN32
+#define GEOMDATA_EXPORT __declspec( dllexport )
+#else
+#define GEOMDATA_EXPORT
+#endif
+#else
+#if defined WIN32
+#define GEOMDATA_EXPORT __declspec( dllimport )
+#else
+#define GEOMDATA_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+// File: ModelAPI_AttributeDouble.cxx
+// Created: 2 Apr 2014
+// Author: Mikhail PONIKAROV
+
+#include "GeomData_Point.h"
+
+using namespace std;
+
+void GeomData_Point::setValue(const double theX, const double theY, const double theZ)
+{
+ myCoords->SetValue(0, theX);
+ myCoords->SetValue(1, theY);
+ myCoords->SetValue(2, theZ);
+}
+
+double GeomData_Point::x() const
+{
+ return myCoords->Value(0);
+}
+
+double GeomData_Point::y() const
+{
+ return myCoords->Value(1);
+}
+
+double GeomData_Point::z() const
+{
+ return myCoords->Value(2);
+}
+
+GeomData_Point::GeomData_Point(TDF_Label& theLabel)
+{
+ // check the attribute could be already presented in this doc (after load document)
+ if (!theLabel.FindAttribute(TDataStd_RealArray::GetID(), myCoords)) {
+ // create attribute: not initialized by value yet, just zero
+ myCoords = TDataStd_RealArray::Set(theLabel, 0, 2);
+ }
+}
--- /dev/null
+// File: GeomData_Point.h
+// Created: 24 Apr 2014
+// Author: Mikhail PONIKAROV
+
+#ifndef GeomData_Point_HeaderFile
+#define GeomData_Point_HeaderFile
+
+#include "GeomData.h"
+#include "GeomDataAPI_Point.h"
+#include <TDataStd_RealArray.hxx>
+#include <TDF_Label.hxx>
+
+/**\class GeomData_Point
+ * \ingroup DataModel
+ * \brief Attribute that contains real value with double precision.
+ */
+
+class GeomData_Point : public ModelAPI_Attribute
+{
+ Handle_TDataStd_RealArray myCoords; ///< X, Y and Z doubles as real array attribute [0; 2]
+public:
+ /// Defines the double value
+ virtual void setValue(const double theX, const double theY, const double theZ);
+
+ /// Returns the X double value
+ virtual double x() const;
+ /// Returns the Y double value
+ virtual double y() const;
+ /// Returns the Z double value
+ virtual double z() const;
+
+protected:
+ /// Initializes attributes
+ GeomData_Point(TDF_Label& theLabel);
+};
+
+#endif
--- /dev/null
+FIND_PACKAGE(SWIG REQUIRED)
+INCLUDE(${SWIG_USE_FILE})
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+SET(PROJECT_HEADERS
+ GeomDataAPI.h
+ GeomDataAPI_Point.h
+)
+
+SET(CMAKE_SWIG_FLAGS "")
+
+SET_SOURCE_FILES_PROPERTIES(GeomDataAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(GeomDataAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+INCLUDE_DIRECTORIES(
+ ../ModelAPI
+)
+
+SET(SWIG_SCRIPTS
+ ${CMAKE_CURRENT_BINARY_DIR}/GeomDataAPI.py
+)
+
+SET(SWIG_LINK_LIBRARIES
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SWIG_ADD_MODULE(GeomDataAPI python GeomDataAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(GeomDataAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_GeomDataAPI PROPERTIES DEBUG_OUTPUT_NAME _GeomDataAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _GeomDataAPI DESTINATION swig)
+INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION swig)
--- /dev/null
+#ifndef GEOMDATAAPI_H
+#define GEOMDATAAPI_H
+
+#if defined GEOMDATAAPI_EXPORTS
+#if defined WIN32
+#define GEOMDATAAPI_EXPORT __declspec( dllexport )
+#else
+#define GEOMDATAAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define GEOMDATAAPI_EXPORT __declspec( dllimport )
+#else
+#define GEOMDATAAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* GeomDataAPI.i */
+%module GeomDataAPI
+%{
+ #include "GeomDataAPI.h"
+ #include "GeomDataAPI_Point.h"
+ #include <boost/shared_ptr.hpp>
+%}
+
+// to avoid error on this
+#define GEOMDATAAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_string.i"
+//%include <std_shared_ptr.i>
+
+// boost pointers
+%include <boost_shared_ptr.i>
+%shared_ptr(GeomDataAPI_Point)
+
+// all supported interfaces
+%include "GeomDataAPI_Point.h"
--- /dev/null
+// File: GeomData_AttributeDouble.h
+// Created: 2 Apr 2014
+// Author: Mikhail PONIKAROV
+
+#ifndef GeomData_AttributeDouble_HeaderFile
+#define GeomData_AttributeDouble_HeaderFile
+
+#include "GeomDataAPI.h"
+#include <ModelAPI_Attribute.h>
+
+/**\class GeomData_AttributeDouble
+ * \ingroup DataModel
+ * \brief Attribute that contains real value with double precision.
+ */
+
+class GeomDataAPI_Point : public ModelAPI_Attribute
+{
+public:
+ /// Defines the double value
+ virtual void setValue(const double theX, const double theY, const double theZ) = 0;
+
+ /// Returns the X double value
+ virtual double x() = 0;
+ /// Returns the Y double value
+ virtual double y() = 0;
+ /// Returns the Z double value
+ virtual double z() = 0;
+
+ /// Returns the type of this class of attributes
+ static inline std::string type() {return std::string("Point");}
+
+ /// Returns the type of this class of attributes, not static method
+ virtual std::string attributeType() {return type();}
+
+protected:
+ /// Objects are created for features automatically
+ GeomDataAPI_Point()
+ {}
+};
+
+#endif
// Read plugins information from XML files
Config_ModuleReader aXMLReader("FeatureRegisterEvent");
- aXMLReader.setAutoImport(true);
aXMLReader.readAll();
}
void PartSet_Module::createFeatures()
{
Config_ModuleReader aXMLReader = Config_ModuleReader();
- aXMLReader.setAutoImport(true);
aXMLReader.readAll();
+ myFeaturesInFiles = aXMLReader.featuresInFiles();
}
void PartSet_Module::featureCreated(XGUI_Command* theFeature)
theFeature->connectTo(this, SLOT(onFeatureTriggered()));
}
-std::string PartSet_Module::modulePlugin()
+std::string PartSet_Module::featureFile(const std::string& theFeatureId)
{
- Config_ModuleReader aModuleReader = Config_ModuleReader();
- aModuleReader.readAll();
- std::map < std::string, std::string > aPluginMap = aModuleReader.plugins();
- std::string aPluginName = aPluginMap["PartSetPlugin"];
- return aPluginName;
+ return myFeaturesInFiles[theFeatureId];
}
/*
*/
void PartSet_Module::onFeatureTriggered()
{
- std::string aPluginName = modulePlugin();
- Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginName);
- aWdgReader.readAll();
XGUI_Command* aCmd = dynamic_cast<XGUI_Command*>(sender());
QString aCmdId = aCmd->id();
- std::string aXmlCfg = aWdgReader.featureWidgetCfg(aCmdId.toStdString());
- std::string aDescription = aWdgReader.featureDescription(aCmdId.toStdString());
+ std::string aStdCmdId = aCmdId.toStdString();
+ std::string aPluginFileName = featureFile(aStdCmdId);
+ Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginFileName);
+ aWdgReader.readAll();
+ std::string aXmlCfg = aWdgReader.featureWidgetCfg(aStdCmdId);
+ std::string aDescription = aWdgReader.featureDescription(aStdCmdId);
ModuleBase_PropPanelOperation* aPartSetOp;
if (aCmdId == "Sketch" ) {
aPartSetOp = new PartSet_OperationSketch(aCmdId, this);
#include <XGUI_Module.h>
#include <XGUI_Command.h>
+#include <QMap>
#include <QObject>
+#include <string>
+
class PARTSET_EXPORT PartSet_Module: public QObject, public XGUI_Module
{
Q_OBJECT
- std::string modulePlugin();
public:
PartSet_Module(XGUI_Workshop* theWshop);
virtual void createFeatures();
virtual void featureCreated(XGUI_Command* theFeature);
+ std::string featureFile(const std::string&);
public slots:
void onFeatureTriggered();
private:
XGUI_Workshop* myWorkshop;
+
+ std::map<std::string, std::string> myFeaturesInFiles;
};
#endif
#include "SketchPlugin_Sketch.h"
#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeDouble.h>
#include <GeomAlgoAPI_FaceBuilder.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
void SketchPlugin_Sketch::initAttributes()
{
- //data()->addAttribute(PART_ATTR_DOC_REF, ModelAPI_AttributeDocRef::type());
+ data()->addAttribute(SKETCH_ATTR_PLANE_A, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(SKETCH_ATTR_PLANE_B, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(SKETCH_ATTR_PLANE_C, ModelAPI_AttributeDouble::type());
+ data()->addAttribute(SKETCH_ATTR_PLANE_D, ModelAPI_AttributeDouble::type());
}
void SketchPlugin_Sketch::execute()
#include "SketchPlugin.h"
#include <SketchPlugin_Feature.h>
-
#include <list>
-/// part reference attribute
-const std::string PART_ATTR_DOC_REF = "SketchDocument";
+/// Coefficient A of the sketch plane (Ax+By+Cz+D=0)
+const std::string SKETCH_ATTR_PLANE_A("PlaneA");
+/// Coefficient B of the sketch plane
+const std::string SKETCH_ATTR_PLANE_B("PlaneB");
+/// Coefficient C of the sketch plane
+const std::string SKETCH_ATTR_PLANE_C("PlaneC");
+/// Coefficient D of the sketch plane
+const std::string SKETCH_ATTR_PLANE_D("PlaneD");
/**\class SketchPlugin_Sketch
* \ingroup DataModel
/// \param theShapes the list of result shapes
void addPlane(double theX, double theY, double theZ,
std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes) const;
-
};
#endif