]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Preliminary changes for SketchSolver
authorazv <azv@opencascade.com>
Thu, 8 May 2014 03:14:30 +0000 (07:14 +0400)
committerazv <azv@opencascade.com>
Thu, 8 May 2014 08:25:29 +0000 (12:25 +0400)
12 files changed:
CMakeCommon/FindSolveSpace.cmake [new file with mode: 0644]
CMakeLists.txt
linux_env.sh
msvc10_env.bat
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Point.cpp [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_Point.h [new file with mode: 0644]
src/SketchPlugin/plugin-Sketch.xml
src/SketchSolver/CMakeLists.txt [new file with mode: 0644]
src/SketchSolver/SketchSolver.h [new file with mode: 0644]
src/SketchSolver/SketchSolver_Solver.cpp [new file with mode: 0644]
src/SketchSolver/SketchSolver_Solver.h [new file with mode: 0644]

diff --git a/CMakeCommon/FindSolveSpace.cmake b/CMakeCommon/FindSolveSpace.cmake
new file mode 100644 (file)
index 0000000..b373d2c
--- /dev/null
@@ -0,0 +1,6 @@
+SET(SLVS_ROOT_DIR $ENV{SOLVESPACE_ROOT_DIR})
+
+INCLUDE_DIRECTORIES(${SLVS_ROOT_DIR}/include)
+LINK_DIRECTORIES(${SLVS_ROOT_DIR}/lib)
+
+SET(SLVS_LIBRARIES ${SLVS_ROOT_DIR}/lib/slvs.lib)
index 223001654d8af64d32e6ca78337d7cd769ad1fec..18fbdfc7ca1c0001200b8802ed1aec2b4e92c936 100644 (file)
@@ -9,6 +9,7 @@ INCLUDE(FindQt)
 INCLUDE(FindBoost)
 INCLUDE(FindPython)
 INCLUDE(FindSalome)
+INCLUDE(FindSolveSpace)
 
 IF(UNIX)
     IF(CMAKE_COMPILER_IS_GNUCC)
@@ -31,6 +32,7 @@ ADD_SUBDIRECTORY (src/GeomDataAPI)
 ADD_SUBDIRECTORY (src/PartSetPlugin)
 ADD_SUBDIRECTORY (src/ConstructionPlugin)
 ADD_SUBDIRECTORY (src/SketchPlugin)
+ADD_SUBDIRECTORY (src/SketchSolver)
 ADD_SUBDIRECTORY (src/ModuleBase)
 ADD_SUBDIRECTORY (src/PartSet)
 ADD_SUBDIRECTORY (src/PyConsole)
index 170f3bf3d0bad083faf6f4411e828079081d79d8..8fb9f33ff6c1dacff7fe498a82373748eebd3249 100644 (file)
@@ -68,6 +68,10 @@ export LIBXML2_INCLUDE_DIR=${LIBXML2_ROOT_DIR}/include/libxml2
 export LIBXML2_LIB_DIR=${LIBXML2_ROOT_DIR}/lib
 export LIBXML2_BIN_DIR=${LIBXML2_ROOT_DIR}/bin
 ##
+#------ SolveSpace ------
+export SOLVESPACE_ROOT_DIR=${PDIR}/solvespace-2.0
+export LD_LIBRARY_PATH=${SOLVESPACE_ROOT_DIR}/lib:${LD_LIBRARY_PATH}
+##
 #------ OCCT ------
 export CAS_ROOT_DIR=${PDIR}/OCCT-6.7.0
 
index 7717e8047d9d515e66827a98b2cb650e8085dc98..1d2233ce4347d693a6ed7525d8893254246317e8 100644 (file)
@@ -126,6 +126,11 @@ set PATH=%CMAKEDIR%\bin;%PATH%
 @SET PATH=%BOOST_ROOT_DIR%\lib;%PATH%
 @REM -------------------------
 
+@REM -------------------------
+@SET SOLVESPACE_ROOT_DIR=%PDIR%\solvespace-2.0
+@SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH%
+@REM -------------------------
+
 @SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
 @SET PATH=%ROOT_DIR%\install\plugins;%PATH%
 
index 347fabe8818e0f69d364c882db8d78958406e317..15ec42e10db4af201a423c5e0af339bc94e4da8f 100644 (file)
@@ -6,6 +6,7 @@ SET(PROJECT_HEADERS
     SketchPlugin_Plugin.h
     SketchPlugin_Sketch.h
     SketchPlugin_Line.h
+    SketchPlugin_Point.h
 )
 
 SET(PROJECT_SOURCES
@@ -13,6 +14,7 @@ SET(PROJECT_SOURCES
     SketchPlugin_Plugin.cpp
     SketchPlugin_Sketch.cpp
     SketchPlugin_Line.cpp
+    SketchPlugin_Point.cpp
 )
 
 SET(PROJECT_LIBRARIES
diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp
new file mode 100644 (file)
index 0000000..fa77d24
--- /dev/null
@@ -0,0 +1,42 @@
+// File:    SketchPlugin_Point.cpp
+// Created: 07 May 2014
+// Author:  Artem ZHIDKOV
+
+#include "SketchPlugin_Point.h"
+#include "SketchPlugin_Sketch.h"
+#include <ModelAPI_Data.h>
+////#include <GeomAPI_Pnt.h>
+////#include <GeomAlgoAPI_EdgeBuilder.h>
+#include <GeomDataAPI_Point2D.h>
+
+using namespace std;
+
+////// face of the square-face displayed for selection of general plane
+////const double PLANE_SIZE = 200;
+
+SketchPlugin_Point::SketchPlugin_Point()
+{
+}
+
+void SketchPlugin_Point::initAttributes()
+{
+  data()->addAttribute(POINT_ATTR_COORD, GeomDataAPI_Point2D::type());
+}
+
+void SketchPlugin_Point::execute() 
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Point::preview()
+{
+  SketchPlugin_Sketch* aSketch = sketch();
+  // compute a point in 3D view
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = 
+    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(POINT_ATTR_COORD));
+  boost::shared_ptr<GeomAPI_Pnt> aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y()));
+  // make a visible point
+  //boost::shared_ptr<GeomAPI_Shape> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
+  //setPreview(anEdge);
+
+  return getPreview();
+}
diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h
new file mode 100644 (file)
index 0000000..f4ecc49
--- /dev/null
@@ -0,0 +1,48 @@
+// File:    SketchPlugin_Point.h
+// Created: 07 May 2014
+// Author:  Artem ZHIDKOV
+
+#ifndef SketchPlugin_Point_HeaderFile
+#define SketchPlugin_Point_HeaderFile
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_Feature.h"
+#include <list>
+
+/// Coordinates of the point
+const std::string POINT_ATTR_COORD("PointCoordindates");
+
+/**\class SketchPlugin_Point
+ * \ingroup DataModel
+ * \brief Feature for creation of a new point.
+ */
+class SketchPlugin_Point: public SketchPlugin_Feature
+{
+public:
+  /// Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
+  {static std::string MY_KIND = "SketchPoint"; return MY_KIND;}
+
+  /// Returns to which group in the document must be added feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
+  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+  /// Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+  /// Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+  /// Returns the sketch preview
+  SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+  /// Adds sub-feature of the higher level feature (sub-element of the sketch)
+  /// \param theFeature sub-feature
+  SKETCHPLUGIN_EXPORT virtual const void addSub(
+    const boost::shared_ptr<ModelAPI_Feature>& theFeature) {};
+
+  /// Use plugin manager for features creation
+  SketchPlugin_Point();
+};
+
+#endif
index 2feedd6d7372fbe64d3e6094a55d30616ae332d5..8730c2ef83336e3a2e87b011f8b0e02bdcc2003d 100644 (file)
@@ -5,6 +5,7 @@
         <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="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"/>
diff --git a/src/SketchSolver/CMakeLists.txt b/src/SketchSolver/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4ac9b2f
--- /dev/null
@@ -0,0 +1,31 @@
+INCLUDE(Common)
+INCLUDE(FindSolveSpace)
+
+SET(PROJECT_HEADERS
+    SketchSolver.h
+    SketchSolver_Solver.h
+)
+
+SET(PROJECT_SOURCES
+    SketchSolver_Solver.cpp
+)
+
+SET(PROJECT_LIBRARIES
+    ${SLVS_LIBRARIES}
+    SketchPlugin
+)
+
+SET(INCLUDE_DIRECTORIES
+    ../SketchPlugin
+)
+
+ADD_LIBRARY(SketchSolver SHARED 
+    ${PROJECT_SOURCES} 
+    ${PROJECT_HEADERS}
+)
+
+TARGET_LINK_LIBRARIES(SketchSolver
+    ${PROJECT_LIBRARIES}
+)
+
+INSTALL(TARGETS SketchSolver DESTINATION plugins)
diff --git a/src/SketchSolver/SketchSolver.h b/src/SketchSolver/SketchSolver.h
new file mode 100644 (file)
index 0000000..2f98bf5
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef SKETCHSOLVER_H
+#define SKETCHSOLVER_H
+
+#if defined SKETCHSOLVER_EXPORTS
+#if defined WIN32
+#define SKETCHSOLVER_EXPORT              __declspec( dllexport )
+#else
+#define SKETCHSOLVER_EXPORT
+#endif
+#else
+#if defined WIN32
+#define SKETCHSOLVER_EXPORT              __declspec( dllimport )
+#else
+#define SKETCHSOLVER_EXPORT
+#endif
+#endif
+
+#endif
diff --git a/src/SketchSolver/SketchSolver_Solver.cpp b/src/SketchSolver/SketchSolver_Solver.cpp
new file mode 100644 (file)
index 0000000..bf86e4d
--- /dev/null
@@ -0,0 +1,5 @@
+// File:    SketchSolver_Solver.cpp
+// Created: 07 May 2014
+// Author:  Artem ZHIDKOV
+
+#include "SketchSolver_Solver.h"
diff --git a/src/SketchSolver/SketchSolver_Solver.h b/src/SketchSolver/SketchSolver_Solver.h
new file mode 100644 (file)
index 0000000..beb2f24
--- /dev/null
@@ -0,0 +1,10 @@
+// File:    SketchSolver_Solver.h
+// Created: 07 May 2014
+// Author:  Artem ZHIDKOV
+
+#ifndef SketchSolver_Solver_Headerfile
+#define SketchSolver_Solver_Headerfile
+
+#include "SketchSolver.h"
+
+#endif