From: vsr Date: Mon, 1 Jun 2015 13:56:12 +0000 (+0300) Subject: Initial repository creation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=af6f6cfaacb2c9c2de9cc203d191c301dbb0506e;p=plugins%2Fcanrecplugin.git Initial repository creation --- af6f6cfaacb2c9c2de9cc203d191c301dbb0506e diff --git a/CANRECPlugin_version.h.in b/CANRECPlugin_version.h.in new file mode 100644 index 0000000..7baffbc --- /dev/null +++ b/CANRECPlugin_version.h.in @@ -0,0 +1,41 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGIN_VERSION_H) +#define __CANRECPLUGIN_VERSION_H + +/*! + Specify version of SALOME CANRECPLUGIN module, as follows + + CANRECPLUGIN_VERSION_MAJOR : (integer) number identifying major version + CANRECPLUGIN_VERSION_MINOR : (integer) number identifying minor version + CANRECPLUGIN_VERSION_MAINTENANCE : (integer) number identifying maintenance version + CANRECPLUGIN_VERSION_STR : (string) complete version number "major.minor.maintenance" + CANRECPLUGIN_VERSION : (hex) complete version number (major << 16) + (minor << 8) + maintenance + CANRECPLUGIN_DEVELOPMENT : (integer) indicates development version when set to 1 +*/ + +#define CANRECPLUGIN_VERSION_MAJOR @SALOMECANRECPLUGIN_MAJOR_VERSION@ +#define CANRECPLUGIN_VERSION_MINOR @SALOMECANRECPLUGIN_MINOR_VERSION@ +#define CANRECPLUGIN_VERSION_MAINTENANCE @SALOMECANRECPLUGIN_PATCH_VERSION@ +#define CANRECPLUGIN_VERSION_STR "@SALOMECANRECPLUGIN_VERSION@" +#define CANRECPLUGIN_VERSION @SALOMECANRECPLUGIN_XVERSION@ +#define CANRECPLUGIN_DEVELOPMENT @SALOMECANRECPLUGIN_VERSION_DEV@ + +#endif // __CANRECPLUGIN_VERSION_H diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..be217c3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,227 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) +PROJECT(SalomeCANRECPLUGIN C CXX) + +# Ensure a proper linker behavior: +CMAKE_POLICY(SET CMP0003 NEW) + +# Versioning +# ========== +# Project name, upper case +STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) + +SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 6) +SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) +SET(${PROJECT_NAME_UC}_VERSION + ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) +SET(${PROJECT_NAME_UC}_VERSION_DEV 0) + +# Find KERNEL +# =========== +SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the SALOME KERNEL") +IF(EXISTS ${KERNEL_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") + INCLUDE(SalomeMacros) + FIND_PACKAGE(SalomeKERNEL REQUIRED) + KERNEL_WITH_CORBA() #check whether KERNEL is built with CORBA + ADD_DEFINITIONS(${KERNEL_DEFINITIONS}) + INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS}) +ELSE(EXISTS ${KERNEL_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a SALOME KERNEL, please define KERNEL_ROOT_DIR") +ENDIF(EXISTS ${KERNEL_ROOT_DIR}) + +# Platform setup +# ============== +INCLUDE(SalomeSetupPlatform) # From KERNEL +# Always build libraries as shared objects: +SET(BUILD_SHARED_LIBS TRUE) +# Local macros: +LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files") + +# Find GEOM +# ========= +SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the SALOME Geometry") +IF(EXISTS ${GEOM_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${GEOM_ROOT_DIR}/adm_local/cmake_files") + FIND_PACKAGE(SalomeGEOM REQUIRED) + ADD_DEFINITIONS(${GEOM_DEFINITIONS}) + INCLUDE_DIRECTORIES(${GEOM_INCLUDE_DIRS}) +ELSE(EXISTS ${GEOM_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a SALOME Geometry, please define GEOM_ROOT_DIR") +ENDIF(EXISTS ${GEOM_ROOT_DIR}) + +# User options +# ============ +OPTION(SALOME_BUILD_GUI "Enable GUI" ${SALOME_GEOM_BUILD_GUI}) +OPTION(SALOME_BUILD_DOC "Generate SALOME CANRECPLUGIN documentation" ON) +OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) +OPTION(CANREC_LICENSE "OCCT Canonical recognition license key" "") + +# Find GUI (optional) +# =================== +IF(SALOME_BUILD_GUI) + SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the SALOME GUI") + IF(EXISTS ${GUI_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files") + FIND_PACKAGE(SalomeGUI) + FULL_GUI(TRUE) # check whether GUI is built in full mode and with CORBA + ELSE(EXISTS ${GUI_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a SALOME GUI, please define GUI_ROOT_DIR") + ENDIF(EXISTS ${GUI_ROOT_DIR}) + IF(NOT SALOME_GEOM_BUILD_GUI) + MESSAGE(FATAL_ERROR "SALOME Geometry module is built without GUI") + ENDIF(NOT SALOME_GEOM_BUILD_GUI) + SALOME_LOG_OPTIONAL_PACKAGE(SalomeGUI SALOME_BUILD_GUI) +ENDIF(SALOME_BUILD_GUI) + +IF(SALOME_BUILD_TESTS) + ENABLE_TESTING() +ENDIF() + +IF(CANREC_LICENSE) + ADD_DEFINITIONS(-DCANREC_HASLICENSE) +ELSE() + MESSAGE(WARNING "OCCT Canonical recognition license key is not specified! Runtime license will be required!") +ENDIF() + +# Pre-requisites +# ============== +FIND_PACKAGE(SalomePython REQUIRED) +FIND_PACKAGE(SalomeCAS REQUIRED) +FIND_PACKAGE(SalomeCR REQUIRED) +FIND_PACKAGE(SalomeOmniORB REQUIRED) +FIND_PACKAGE(SalomeOmniORBPy REQUIRED) +IF(SALOME_BUILD_GUI) + FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) +ENDIF(SALOME_BUILD_GUI) +IF(SALOME_BUILD_DOC) + FIND_PACKAGE(SalomeDoxygen) + SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC) +ENDIF() + +# Detection summary: +SALOME_PACKAGE_REPORT_AND_CHECK() + +# Directories +# =========== +SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries") +SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs") +SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files") +SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers") +SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH + "Install path: SALOME scripts") +SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH + "Install path: SALOME script data") +SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH + "Install path: SALOME Python scripts") +SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff") +SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH + "Install path: SALOME Python shared modules") +SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH + "Install path: local SALOME CMake files") +SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources") +SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation") + +# Specific to CANRECPLUGIN: +SET(SALOME_CANRECPLUGIN_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/canrecplugin" CACHE PATH + "Install path: SALOME CANRECPLUGIN specific data") + +MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS) +MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON) +MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) +MARK_AS_ADVANCED(SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES SALOME_INSTALL_DOC) +MARK_AS_ADVANCED(SALOME_CANRECPLUGIN_INSTALL_RES_DATA) + +# Accumulate environment variables for CANRECPLUGIN module +SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}) +SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) + +# Sources +# ======= +ADD_SUBDIRECTORY(idl) +ADD_SUBDIRECTORY(adm_local) +ADD_SUBDIRECTORY(resources) +ADD_SUBDIRECTORY(src) +IF(SALOME_BUILD_DOC) + ADD_SUBDIRECTORY(doc) +ENDIF(SALOME_BUILD_DOC) + +# Header configuration +# ==================== +SALOME_XVERSION(${PROJECT_NAME}) +SALOME_CONFIGURE_FILE(CANRECPlugin_version.h.in CANRECPlugin_version.h INSTALL ${SALOME_INSTALL_HEADERS}) + +# Configuration export +# (here only the level 1 prerequisites are exposed) +# ==================== +INCLUDE(CMakePackageConfigHelpers) + +# List of targets in this project we want to make visible to the rest of the world. +# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" +SET(_${PROJECT_NAME}_exposed_targets + SalomeIDLCANRECPlugin CANRECPluginEngine +) + +IF(SALOME_BUILD_GUI) + LIST(APPEND _${PROJECT_NAME}_exposed_targets + CANRECPluginGUI + ) +ENDIF(SALOME_BUILD_GUI) + +# Add all targets to the build-tree export set +EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} + FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake) + +# Ensure the variables are always defined for the configure: +SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}") +SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}") +SET(GEOM_ROOT_DIR "${GEOM_ROOT_DIR}") +SET(CR_ROOT_DIR "${CR_ROOT_DIR}") +SET(OCCLICENSE_ROOT_DIR "${OCCLICENSE_ROOT_DIR}") + +SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") + +# Build variables that will be expanded when configuring SalomeConfig.cmake: +SALOME_CONFIGURE_PREPARE(CR) + +CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in + ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" + PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX + KERNEL_ROOT_DIR GUI_ROOT_DIR GEOM_ROOT_DIR CR_ROOT_DIR OCCLICENSE_ROOT_DIR) + +WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + VERSION ${${PROJECT_NAME_UC}_VERSION} + COMPATIBILITY AnyNewerVersion) + +# Install the CMake configuration files: +INSTALL(FILES + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}") + +# Install the export set for use with the install-tree +INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" + FILE ${PROJECT_NAME}Targets.cmake) + +# Install README file +INSTALL(FILES README DESTINATION ${SALOME_CANRECPLUGIN_INSTALL_RES_DATA}) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..b1e3f5a --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..c92f465 --- /dev/null +++ b/INSTALL @@ -0,0 +1,111 @@ +************************* +Installation Instructions +************************* + +Copyright (C) 2014-2015 OPEN CASCADE + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +See http://www.salome-platform.org or email : webmaster.salome@opencascade.com + +============== +Pre-requisites +============== + +OCCT Canonical recognition (CANREC) plugin for SALOME Geometry module requires: + +- SALOME, at least KERNEL and GEOM modules (http://www.salome-platform.org). +- Open CASCADE Technology and OCCT Canonical recognition (CR) product + (http://www.opencascade.org). +- Other pre-requisite products, according to the SALOME pre-requisites list. + +================== +Basic Installation +================== + +The build procedure of the CANREC plugin for SALOME Geometry module is +created using CMake build system. +In order to build the plugin you have to do the following actions: + +1. Set an environment to point to the OCCT Canonical recognition product, +for example: + + - for csh: + + % setenv CR_ROOT_DIR /path/to/the/CR-6.9.0 + % setenv LD_LIBRARY_PATH ${CR_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + + - for bash: + + % export CR_ROOT_DIR=/path/to/the/CR-6.9.0 + % export LD_LIBRARY_PATH=${CR_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + + Note, that OCCT CR product requires OCCT license library. + Normally OCCT license library is distributed with OCCT CR + product, but it can also be distributed separately. In latter + case you might need to set-up environment to point to the OCCT + license library, as follows: + + - for csh: + + % setenv OCCLICENSE_ROOT_DIR /path/to/the/OCCLicense-6.9.0 + % setenv LD_LIBRARY_PATH ${OCCLICENSE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + + - for bash: + + % export OCCLICENSE_ROOT_DIR=/path/to/the/OCCLicense-6.9.0 + % export LD_LIBRARY_PATH=${OCCLICENSE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + +2. Create a build directory (in the example below, it is assumed + that this directory is created at the same level as sources + directory CANRECPLUGIN_SRC), for example: + + % mkdir CANRECPLUGIN_BUILD + +3. Configure the build procedure: + + % cd CANRECPLUGIN_BUILD + % cmake -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX= ../CANRECPLUGIN_SRC + + where + - is either Release or Debug; + - is a destination folder to install CANREC plugin. + + By default (if CMAKE_INSTALL_PREFIX option is not given), CANREC plugin will be + configured for installation to the /usr directory that requires root + permissions to complete the installation. + +4. Build and install CANREC plugin: + + % make + % make install + + This will install CANREC plugin to the specified + with cmake command on previous step. + +=================== +Custom installation +=================== + +For setting unusual options for compilation or linking run the following +commands o get details on some of the pertinent environment variables: + + % cd CANRECPLUGIN_BUILD + % ccmake ../CANRECPLUGIN_SRC + +You can also use other options of cmake command to customize +your installation. Learn more about available options by running + + % cmake --help diff --git a/README b/README new file mode 100644 index 0000000..898d7be --- /dev/null +++ b/README @@ -0,0 +1,117 @@ +****** +README +****** + +Copyright (C) 2014-2015 OPEN CASCADE + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +See http://www.salome-platform.org or email : webmaster.salome@opencascade.com + +============ +Introduction +============ + +This is an implementation of OCCT Canonical recognition (CANREC) interface +to be used as plugin for SALOME Geometry module. It provides functionality +to convert, if possible, a NURBS geometry (B-Spline / Bezier curve or surface) +to its analytical form (primitive curve or surface). +Please visit http://www.opencascade.org/support/products/canrec/ for more details +about OCCT Canonical recognition component. + +============ +Installation +============ + +See the INSTALL file for more information. + +===== +Usage +===== + +1. Set environment (DO NOT FORGET to correct path) + + * Set CANRECPLUGIN_ROOT_DIR variable that should point to the CANREC plugin + installation directory. It is required for SALOME Geometry module to + automatically detect a plugin (see APPENDIX below). For example: + + - for csh: + + % setenv CANRECPLUGIN_ROOT_DIR /path/to/the/CANRECPLUGIN + + - for bash: + + % export CANRECPLUGIN_ROOT_DIR=/path/to/the/CANRECPLUGIN + + * Set LD_LIBRARY_PATH variable to point to the OCCT Canonical + recognition product libraries, for example: + + - for csh: + + % setenv CR_ROOT_DIR /path/to/the/CR-6.9.0 + % setenv LD_LIBRARY_PATH ${CR_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + + - for bash: + + % export CR_ROOT_DIR=/path/to/the/CR-6.9.0 + % export LD_LIBRARY_PATH=${CR_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + + * OCCT Canonical recognition product requires also an OCCT license + library. Normally OCCT license library is distributed with OCCT CR + product, but it can also be distributed separately. In latter + case you might need to set-up environment to point to the OCCT + license library, as follows: + + - for csh: + + % setenv OCCLICENSE_ROOT_DIR /path/to/the/OCCLicense-6.9.0 + % setenv LD_LIBRARY_PATH ${OCCLICENSE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + + - for bash: + + % export OCCLICENSE_ROOT_DIR=/path/to/the/OCCLicense-6.9.0 + % export LD_LIBRARY_PATH=${OCCLICENSE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} + +2. Usage in SALOME + + * Run SALOME and activate Geometry module. + + * Invoke Canonical Recognition operation + + Menu New Entity - Advanced - Canonical Recognition + + In the "Canonical Recognition Construction" dialog box specify input shape, + tolerance value and, optionally, switch on/off "Merge surfaces" and "Merge curves" + check boxes. Press "Apply" or "Apply and Close' button to start canonical recognition + operation. + The result of the operation will be published in the study. + +=============== +Troubleshooting +=============== + +Please, send a mail to webmaster.salome@opencascade.com + +======== +APPENDIX +======== + +Since SALOME version 7.4.0, Geometry module implements a mechanism to +automatically detect plugins. To set-up the plug-in to SALOME Geometry +module, it is just necessary to set CANRECPLUGIN_ROOT_DIR environment +variable to point to the installation directory of CANREC plugin as described +in paragraph "Usage" above. + +SALOME CANREC plugin supports SALOME 7.6.0 and newer. diff --git a/SalomeCANRECPLUGINConfig.cmake.in b/SalomeCANRECPLUGINConfig.cmake.in new file mode 100644 index 0000000..d484ad7 --- /dev/null +++ b/SalomeCANRECPLUGINConfig.cmake.in @@ -0,0 +1,113 @@ +# Config file for the @PROJECT_NAME@ package +# It defines the following variables: +# Specific to the pacakge @PROJECT_NAME@ itself: +# @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file +# + +############################################################### +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE: +@PACKAGE_INIT@ + +# Load the dependencies for the libraries of @PROJECT_NAME@ +# (contains definitions for IMPORTED targets). This is only +# imported if we are not built as a subproject (in this case targets are already there) +IF(NOT TARGET CANRECPluginEngine AND NOT @PROJECT_NAME@_BINARY_DIR) + INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE_LOCAL@/@PROJECT_NAME@Targets.cmake") +ENDIF() + +# Package root dir: +SET_AND_CHECK(CANRECPLUGIN_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@") + +# Include directories +SET_AND_CHECK(CANRECPLUGIN_INCLUDE_DIRS "${CANRECPLUGIN_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@") +SET(CANRECPLUGIN_INCLUDE_DIRS "${CANRECPLUGIN_INCLUDE_DIRS};@_SalomeCANRECPLUGIN_EXTRA_HEADERS@") + +# Package specific environment variables +@_SalomeCANRECPLUGIN_EXTRA_ENV_FULL@ + +#### Now the specificities + +# Options exported by the package: +SET(SALOME_CANRECPLUGIN_BUILD_DOC @SALOME_BUILD_DOC@) +SET(SALOME_CANRECPLUGIN_BUILD_TESTS @SALOME_BUILD_TESTS@) +SET(SALOME_CANRECPLUGIN_BUILD_GUI @SALOME_BUILD_GUI@) + +# Level 1 prerequisites: +SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@") +SET_AND_CHECK(GUI_ROOT_DIR_EXP "@PACKAGE_GUI_ROOT_DIR@") +SET_AND_CHECK(GEOM_ROOT_DIR_EXP "@PACKAGE_GEOM_ROOT_DIR@") +SET_AND_CHECK(CR_ROOT_DIR_EXP "@PACKAGE_CR_ROOT_DIR@") +SET_AND_CHECK(OCCLICENSE_ROOT_DIR_EXP "@PACKAGE_OCCLICENSE_ROOT_DIR@") + +# For all prerequisites, load the corresponding targets if the package was used +# in CONFIG mode. This ensures dependent projects link correctly +# without having to set LD_LIBRARY_PATH: +SET(_PREREQ @_PREREQ_LIST@) +SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@) +SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@") +LIST(LENGTH _PREREQ_CONFIG_DIR _list_len) +IF(NOT _list_len EQUAL 0) + # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ... + MATH(EXPR _range "${_list_len}-1") + FOREACH(_p RANGE ${_range}) + LIST(GET _PREREQ ${_p} _pkg ) + LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir) + LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo) + MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...") + IF(NOT _pkg_compo) + FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE + PATHS "${_pkg_dir}" + NO_DEFAULT_PATH) + ELSE() + STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}") + MESSAGE(STATUS "===> (components: ${_pkg_compo})") + FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE + COMPONENTS ${_compo_lst} + PATHS "${_pkg_dir}" + NO_DEFAULT_PATH) + ENDIF() + ENDFOREACH() +ENDIF() + +# Installation directories +SET(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@") +SET(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@") +SET(SALOME_INSTALL_IDLS "@SALOME_INSTALL_IDLS@") +SET(SALOME_INSTALL_HEADERS "@SALOME_INSTALL_HEADERS@") +SET(SALOME_INSTALL_SCRIPT_SCRIPTS "@SALOME_INSTALL_SCRIPT_SCRIPTS@") +SET(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@") +SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@") +SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@") +SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@") +SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@") +SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@") +SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@") + +# Include GEOM targets if they were not already loaded: +IF(NOT (TARGET GEOMEngine)) + INCLUDE("${GEOM_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeGEOMTargets.cmake") +ENDIF() + +# Exposed CANRECPLUGIN targets: +SET(CANRECPLUGIN_SalomeIDlCANRECPlugin SalomeIDLCANRECPlugin) +SET(CANRECPLUGIN_CANRECPluginEngine CANRECPluginEngine) +SET(CANRECPLUGIN_CANRECPluginGUI CANRECPluginGUI) diff --git a/adm_local/CMakeLists.txt b/adm_local/CMakeLists.txt new file mode 100644 index 0000000..aa826d5 --- /dev/null +++ b/adm_local/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +ADD_SUBDIRECTORY(cmake_files) diff --git a/adm_local/cmake_files/CMakeLists.txt b/adm_local/cmake_files/CMakeLists.txt new file mode 100644 index 0000000..69122b0 --- /dev/null +++ b/adm_local/cmake_files/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# =============================================================== +# Files to be installed +# =============================================================== + +# These files are data, module or lib files +SET(_adm_data + FindCR.cmake + FindSalomeCR.cmake + FindSalomeCANRECPLUGIN.cmake +) + +INSTALL(FILES ${_adm_data} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL}) diff --git a/adm_local/cmake_files/FindCR.cmake b/adm_local/cmake_files/FindCR.cmake new file mode 100644 index 0000000..3f7544b --- /dev/null +++ b/adm_local/cmake_files/FindCR.cmake @@ -0,0 +1,58 @@ +# - Find OCCT Canonical recognition (CR) product +# Sets the following variables: +# CR_INCLUDE_DIRS - path to the OCCT CR include directory +# CR_LIBRARIES - path to the OCCT CR libraries to be linked against +# + +######################################################################### +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ------ + +MESSAGE(STATUS "Check for OCCT Canonical recognition product ...") + +# ------ + +SET(CR_ROOT_DIR $ENV{CR_ROOT_DIR}) +SET(OCCLICENSE_ROOT_DIR $ENV{OCCLICENSE_ROOT_DIR}) + +IF(CR_ROOT_DIR) + LIST(APPEND CMAKE_PREFIX_PATH "${CR_ROOT_DIR}") +ENDIF(CR_ROOT_DIR) +IF(OCCLICENSE_ROOT_DIR) + LIST(APPEND CMAKE_PREFIX_PATH "${OCCLICENSE_ROOT_DIR}") +ENDIF(OCCLICENSE_ROOT_DIR) + +FIND_PATH(CR_INCLUDE_DIRS ShapeConvert.hxx PATH_SUFFIXES inc) +FIND_PATH(OCCTLICENSE_INCLUDE_DIRS OCCLicense_Activate.hxx PATH_SUFFIXES inc) +IF(OCCTLICENSE_INCLUDE_DIRS) + LIST(APPEND CR_INCLUDE_DIRS ${OCCTLICENSE_INCLUDE_DIRS}) +ENDIF(OCCTLICENSE_INCLUDE_DIRS) + +FIND_LIBRARY(CR_TKCR NAMES TKCR) +FIND_LIBRARY(CRKOCCLicense NAMES TKOCCLicense) + +SET(CR_LIBRARIES + ${CR_TKCR} + ${CR_TKOCCLicense} +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CR REQUIRED_VARS CR_INCLUDE_DIRS CR_LIBRARIES) diff --git a/adm_local/cmake_files/FindSalomeCANRECPLUGIN.cmake b/adm_local/cmake_files/FindSalomeCANRECPLUGIN.cmake new file mode 100644 index 0000000..b6c3593 --- /dev/null +++ b/adm_local/cmake_files/FindSalomeCANRECPLUGIN.cmake @@ -0,0 +1,34 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +IF(NOT SalomeCANRECPLUGIN_FIND_QUIETLY) + MESSAGE(STATUS "Looking for Salome CANRECPLUGIN ...") +ENDIF() + +SET(CMAKE_PREFIX_PATH "${CANRECPLUGIN_ROOT_DIR}") + +SALOME_FIND_PACKAGE(SalomeCANRECPLUGIN SalomeCANRECPLUGIN CONFIG) + +IF(NOT SalomeCANRECPLUGIN_FIND_QUIETLY) + MESSAGE(STATUS "Found Salome CANRECPLUGIN: ${CANRECPLUGIN_ROOT_DIR}") +ENDIF() + +FOREACH(_res ${SalomeCANRECPLUGIN_EXTRA_ENV}) + SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeCANRECPLUGIN_EXTRA_ENV_${_res}}") +ENDFOREACH() diff --git a/adm_local/cmake_files/FindSalomeCR.cmake b/adm_local/cmake_files/FindSalomeCR.cmake new file mode 100644 index 0000000..4be5750 --- /dev/null +++ b/adm_local/cmake_files/FindSalomeCR.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CR CR_INCLUDE_DIRS 1) +MARK_AS_ADVANCED(CR_INCLUDE_DIRS CR_LIBRARIES) + +IF(CR_FOUND) + SALOME_ACCUMULATE_HEADERS(CR_INCLUDE_DIRS) + SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${CR_LIBRARIES}) +ENDIF() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..0fd283b --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +ADD_SUBDIRECTORY(salome) diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt new file mode 100644 index 0000000..9965b85 --- /dev/null +++ b/doc/salome/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +ADD_SUBDIRECTORY(examples) +ADD_SUBDIRECTORY(gui) diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt new file mode 100644 index 0000000..4615f07 --- /dev/null +++ b/doc/salome/examples/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py") +INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/CANRECPLUGIN) diff --git a/doc/salome/examples/canrecplugindemo.py b/doc/salome/examples/canrecplugindemo.py new file mode 100644 index 0000000..c88ff1e --- /dev/null +++ b/doc/salome/examples/canrecplugindemo.py @@ -0,0 +1,26 @@ +# Canonical Recognition +import os +import salome +salome.salome_init() +from salome.geom import geomBuilder +import GEOM +geompy = geomBuilder.New( salome.myStudy ) + +# Import Shape +path = os.path.join(os.getenv("DATA_DIR"), "Shapes/Iges/geom.igs") +shape_igs = geompy.ImportIGES(path) + +# Build Canonical Recognition +shape_cr = geompy.MakeCanonicalRecognition(shape_igs, True, True, 0.01) + +# Publish in the study +geompy.addToStudy( shape_igs, 'Import from IGS' ) +geompy.addToStudy( shape_cr, 'Canonical Recognition' ) + +# Print what is information +print "=========================================================" +print "Information about original shape:" +print geompy.WhatIs(shape_igs) +print "=========================================================" +print "Information about converted shape:" +print geompy.WhatIs(shape_cr) diff --git a/doc/salome/gui/CANRECPLUGIN/CMakeLists.txt b/doc/salome/gui/CANRECPLUGIN/CMakeLists.txt new file mode 100644 index 0000000..3174136 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SALOME_CONFIGURE_FILE(doxyfile.in doxyfile) +SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py) +SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html) +SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html) + +# Generate a temporary python file, needed for the generation of the documentation +# of the plugin. +SALOME_ACCUMULATE_ENVIRONMENT(GEOM_PluginsList NOCHECK CANRECPlugin) +SET(_plugins_cmd_options ${GEOM_ROOT_DIR}/bin/salome/collect_geom_methods.py -d -o tmp/geomBuilder.py CANRECPlugin) +SALOME_GENERATE_ENVIRONMENT_SCRIPT(_plugins_cmd env_script "${PYTHON_EXECUTABLE}" "${_plugins_cmd_options}") + +SET(kernel_file "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") +IF(WIN32) + STRING(REPLACE "/" "\\" kernel_file ${kernel_file}) +ENDIF(WIN32) + +ADD_CUSTOM_TARGET(usr_docs ${CMAKE_COMMAND} -E make_directory tmp + COMMAND ${PYTHON_EXECUTABLE} ${kernel_file} -o tmp/CANRECPluginBuilder.py ${CMAKE_SOURCE_DIR}/src/CANRECPLUGIN_PY/CANRECPluginBuilder.py + COMMAND ${_plugins_cmd} + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile + COMMAND ${CMAKE_COMMAND} -E remove_directory tmp + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)") +INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CANRECPLUGIN DESTINATION ${SALOME_INSTALL_DOC}/gui) +INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/CANRECPLUGIN) +INSTALL(FILES images/head.png DESTINATION ${SALOME_INSTALL_DOC}/gui/CANRECPLUGIN/canrecpluginpy_doc) + +SET(make_clean_files CANRECPLUGIN canrecpluginpy_doc.tag) +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}") diff --git a/doc/salome/gui/CANRECPLUGIN/doxyfile.in b/doc/salome/gui/CANRECPLUGIN/doxyfile.in new file mode 100644 index 0000000..b9b1884 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/doxyfile.in @@ -0,0 +1,114 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "SALOME CANRECPLUGIN User's Guide" +OUTPUT_DIRECTORY = CANRECPLUGIN +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +TAB_SIZE = 5 + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES + +#--------------------------------------------------------------------------- +#Input related options +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/input +FILE_PATTERNS = *.doc +EXCLUDE = +IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images +EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/doc/salome/examples + +#--------------------------------------------------------------------------- +#HTML related options +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = . +HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header.html +HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html +HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css +TOC_EXPAND = YES +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 300 + + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool... +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = NO +CLASS_GRAPH = NO +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = NO +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = NO +INCLUDED_BY_GRAPH = NO +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = NO +DIRECTORY_GRAPH = NO +DOT_IMAGE_FORMAT = jpg +DOT_FONTNAME = Arial +DOT_PATH =. +DOTFILE_DIRS =. +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1200 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO + + +GENERATE_LEGEND = NO +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +#SORT related options +#--------------------------------------------------------------------------- +SORT_GROUP_NAMES = NO + +#--------------------------------------------------------------------------- +#LaTeX related option +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +EXTRA_PACKAGES = amsmath + +#--------------------------------------------------------------------------- +#RTF related options +#--------------------------------------------------------------------------- +GENERATE_RTF = NO + +#--------------------------------------------------------------------------- +#External reference options +#--------------------------------------------------------------------------- + +TAGFILES = canrecpluginpy_doc.tag=../CANRECPLUGIN/canrecpluginpy_doc +SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/CANRECPLUGIN/doxyfile_py.in b/doc/salome/gui/CANRECPLUGIN/doxyfile_py.in new file mode 100644 index 0000000..4d83e28 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/doxyfile_py.in @@ -0,0 +1,160 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "SALOME CANRECPLUGIN User's Guide" +OUTPUT_DIRECTORY = CANRECPLUGIN +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 5 +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = YES +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = YES +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 25 +SHOW_USED_FILES = NO +SHOW_DIRECTORIES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +EXCLUDE_SYMLINKS = NO +EXAMPLE_RECURSIVE = NO + +#--------------------------------------------------------------------------- +#Input related options +#--------------------------------------------------------------------------- +INPUT = tmp @CMAKE_SOURCE_DIR@/idl/CANRECPlugin.idl +FILE_PATTERNS = +IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images +RECURSIVE = NO +EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/src/CANRECPLUGIN_PY + +#--------------------------------------------------------------------------- +#HTML related options +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = canrecpluginpy_doc +HTML_HEADER = @CMAKE_CURRENT_BINARY_DIR@/static/header_py.html +HTML_FOOTER = @CMAKE_CURRENT_SOURCE_DIR@/static/footer.html +HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/static/salome_extra.css +TOC_EXPAND = YES +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 300 + +#--------------------------------------------------------------------------- +#LaTeX related option +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO + +#--------------------------------------------------------------------------- +#RTF related options +#--------------------------------------------------------------------------- +GENERATE_RTF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = NO +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_FONTNAME = Arial +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = NO +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +#External reference options +#--------------------------------------------------------------------------- +GENERATE_TAGFILE = canrecpluginpy_doc.tag +SEARCHENGINE = YES diff --git a/doc/salome/gui/CANRECPLUGIN/images/canrec_plugin_dlg.png b/doc/salome/gui/CANRECPLUGIN/images/canrec_plugin_dlg.png new file mode 100644 index 0000000..1c724a9 Binary files /dev/null and b/doc/salome/gui/CANRECPLUGIN/images/canrec_plugin_dlg.png differ diff --git a/doc/salome/gui/CANRECPLUGIN/images/head.png b/doc/salome/gui/CANRECPLUGIN/images/head.png new file mode 100644 index 0000000..307d9ef Binary files /dev/null and b/doc/salome/gui/CANRECPLUGIN/images/head.png differ diff --git a/doc/salome/gui/CANRECPLUGIN/input/canrecplugin_python_interface.doc b/doc/salome/gui/CANRECPLUGIN/input/canrecplugin_python_interface.doc new file mode 100644 index 0000000..a575278 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/input/canrecplugin_python_interface.doc @@ -0,0 +1,17 @@ +/*! + +\page canrecplugin_python_interface_page Python Interface + +Python package CANRECPluginBuilder provides a function that performs +canonical recognition of the B-Spline / Bezier curve or surface. + +CANRECPLUGIN plugin dynamically adds this method to the geomBuilder class. + +Below you can see an example of usage of the CANRECPluginBuilder package for performing +of the canonical recognition: + +\anchor canrec_example +

Example of the canonical recognition operation:

+\tui_script{canrecplugindemo.py} + +*/ diff --git a/doc/salome/gui/CANRECPLUGIN/input/canrecplugin_usage_page.doc b/doc/salome/gui/CANRECPLUGIN/input/canrecplugin_usage_page.doc new file mode 100644 index 0000000..c654a5a --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/input/canrecplugin_usage_page.doc @@ -0,0 +1,26 @@ +/*! + +\page canrecplugin_usage_page Constructing of the Canonical Recognition + +To create a Canonical Recognition in the Main Menu select New Entity - > Advanced - > Canonical Recognition + +This Operation constructs a canonical recognition (convert, if possible, a NURBS geometry B-Spline / Bezier curve or surface +to its analytical form) of an \b Object. To constructs the canonical recognition you need to define the shape. +\n Merge Surfaces checkbox allows to merge surfaces in the result shape. +\n Merge Curves checkbox allows to merge curvies in the result shape. +\n The \b Result of the operation will be any \b GEOM_Object. + +\n TUI Command: geompy.MakeCanonicalRecognition(Shape, MergeSurf, MergeCurves), + where Shape is a shape to be converted into canonical recognition, +MergeSurf and MergeCurv flags to merge surfaces / curves in the result shape. + + +\n Arguments: Name + one object. + +\image html canrec_plugin_dlg.png + +\n \b Example: + +Our TUI Script provide you with useful example of the use of \ref canrec_example "Canonical Recognition". + +*/ diff --git a/doc/salome/gui/CANRECPLUGIN/input/index.doc b/doc/salome/gui/CANRECPLUGIN/input/index.doc new file mode 100644 index 0000000..5e1904a --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/input/index.doc @@ -0,0 +1,15 @@ +/*! + +\mainpage Introduction to CANRECPLUGIN + +\b CANRECPLUGIN plugin provides an integration of OCCT Canonical Recognition product to the SALOME Geometry module. + +It allows to convert, if possible, a NURBS geometry (B-Spline / Bezier curve or surface) to its analytical form +(primitive curve or surface). + +To use functionality of the CANRECPLUGIN refer to \subpage canrecplugin_usage_page. + +Also functionality of the CANRECPLUGIN is accessible via +\subpage canrecplugin_python_interface_page "CANRECPLUGIN Python interface". + +*/ diff --git a/doc/salome/gui/CANRECPLUGIN/static/footer.html b/doc/salome/gui/CANRECPLUGIN/static/footer.html new file mode 100644 index 0000000..a9dd3c1 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/static/footer.html @@ -0,0 +1,13 @@ + + + + + + diff --git a/doc/salome/gui/CANRECPLUGIN/static/header.html.in b/doc/salome/gui/CANRECPLUGIN/static/header.html.in new file mode 100644 index 0000000..1ef8119 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/static/header.html.in @@ -0,0 +1,23 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + +$extrastylesheet + + +
+ +
Version: @SALOMECANRECPLUGIN_VERSION@
+ diff --git a/doc/salome/gui/CANRECPLUGIN/static/header_py.html.in b/doc/salome/gui/CANRECPLUGIN/static/header_py.html.in new file mode 100644 index 0000000..c57fec5 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/static/header_py.html.in @@ -0,0 +1,24 @@ + + + + + + + +$projectname: $title +$title + + + +$treeview +$search +$mathjax + +$extrastylesheet + + +
+ +
Version: @SALOMECANRECPLUGIN_VERSION@
+ + diff --git a/doc/salome/gui/CANRECPLUGIN/static/salome_extra.css b/doc/salome/gui/CANRECPLUGIN/static/salome_extra.css new file mode 100644 index 0000000..3e8b838 --- /dev/null +++ b/doc/salome/gui/CANRECPLUGIN/static/salome_extra.css @@ -0,0 +1,29 @@ +/* The extra CSS for doxygen 1.8.3.1 */ + +#titlearea { + background-image:url('head.png'); + background-color: #175783; + border: 1px solid; + height: 80px; + background-repeat: no-repeat; + padding: 0px; + margin: 0px; + width: 99.9%; + border-bottom: 1px solid #5373B4; +} + +div.version { + border:1px solid #0000FF; + color: #CCCCCC; + font-family: Arial, Helvetica, sans-serif; + font-size: 9pt; + text-align: center; + width:100px; + -moz-border-radius: 8px; + margin: 5px; +} + +.navpath li.footer { + line-height:15px; + text-align: right; +} \ No newline at end of file diff --git a/doc/salome/gui/CMakeLists.txt b/doc/salome/gui/CMakeLists.txt new file mode 100644 index 0000000..3c315a2 --- /dev/null +++ b/doc/salome/gui/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +ADD_SUBDIRECTORY(CANRECPLUGIN) diff --git a/idl/CANRECPlugin.idl b/idl/CANRECPlugin.idl new file mode 100644 index 0000000..9bdad0a --- /dev/null +++ b/idl/CANRECPlugin.idl @@ -0,0 +1,49 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __CANRECPlugin_IDL__ +#define __CANRECPlugin_IDL__ + +#include "GEOM_Gen.idl" + +module CANRECPlugin +{ + /*! + * \brief Interface to Canonical Recognition modeling functions. + */ + interface ICanRecOperations : GEOM::GEOM_IOperations + { + /*! + * \brief Perform, if possible, conversion of NURBS (B-Spline, Bezier) geometry to canonical (analytical) form. + * + * \param theObject the input object (solid, compound, compsolid). + * \param theMergeSurf the flag to switch on/off merging surfaces in the result shape. + * \param theMergeCurves the flag to switch on/off merging curves in the result shape. + * \param theTolerance the tolerance of the canonical recognition operation. + * + * \return New GEOM_Object, containing the canonical recognition of the input object. + */ + GEOM::GEOM_Object MakeCanonicalRecognition ( in GEOM::GEOM_Object theObject, + in boolean theMergeSurf, + in boolean theMergeCurves, + in double theTolerance ); + }; +}; + +#endif // __CANRECPlugin_IDL__ diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt new file mode 100644 index 0000000..2da6653 --- /dev/null +++ b/idl/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +INCLUDE(UseOmniORB) + +INCLUDE_DIRECTORIES( + ${KERNEL_INCLUDE_DIRS} + ${GEOM_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + +IF(WIN32) + ADD_DEFINITIONS(-DNOGDI) +ENDIF(WIN32) + +SET(SalomeIDLCANRECPlugin_IDLSOURCES + CANRECPlugin.idl +) + +SET(_idl_include_dirs + ${KERNEL_ROOT_DIR}/idl/salome + ${GEOM_ROOT_DIR}/idl/salome +) + +SET(_idl_link_flags + ${KERNEL_SalomeIDLKernel} + ${GEOM_SalomeIDLGEOM} +) + +OMNIORB_ADD_MODULE(SalomeIDLCANRECPlugin "${SalomeIDLCANRECPlugin_IDLSOURCES}" "${_idl_include_dirs}" "${_idl_link_flags}") +INSTALL(TARGETS SalomeIDLCANRECPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/resources/CANRECPlugin.xml b/resources/CANRECPlugin.xml new file mode 100644 index 0000000..e3d34a7 --- /dev/null +++ b/resources/CANRECPlugin.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt new file mode 100644 index 0000000..a5f6201 --- /dev/null +++ b/resources/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SET(_resource_files + CANRECPlugin.xml + SalomeApp.xml +) + +IF(SALOME_BUILD_GUI) + LIST(APPEND _resource_files + canonicalrecognition.png + tree_canonicalrecognition.png + select1.png + ) +ENDIF(SALOME_BUILD_GUI) + +INSTALL(FILES ${_resource_files} DESTINATION ${SALOME_CANRECPLUGIN_INSTALL_RES_DATA}) diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml new file mode 100644 index 0000000..6999fdd --- /dev/null +++ b/resources/SalomeApp.xml @@ -0,0 +1,32 @@ + + +
+ +
+
+ + +
+
+ +
+
diff --git a/resources/canonicalrecognition.png b/resources/canonicalrecognition.png new file mode 100644 index 0000000..0d70bba Binary files /dev/null and b/resources/canonicalrecognition.png differ diff --git a/resources/select1.png b/resources/select1.png new file mode 100644 index 0000000..ecb252a Binary files /dev/null and b/resources/select1.png differ diff --git a/resources/tree_canonicalrecognition.png b/resources/tree_canonicalrecognition.png new file mode 100644 index 0000000..9e3a2ec Binary files /dev/null and b/resources/tree_canonicalrecognition.png differ diff --git a/src/CANRECPLUGINEngine/CANRECPluginEngine.cxx b/src/CANRECPLUGINEngine/CANRECPluginEngine.cxx new file mode 100644 index 0000000..d4d059e --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginEngine.cxx @@ -0,0 +1,30 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "CANRECPluginEngine.hxx" +#include "CANRECPluginEngine_OperationsCreator.hh" + +extern "C" +{ + CANRECPLUGINENGINE_EXPORT + GEOM_GenericOperationsCreator* GetOperationsCreator() + { + return new CANRECPluginEngine_OperationsCreator(); + } +} diff --git a/src/CANRECPLUGINEngine/CANRECPluginEngine.hxx b/src/CANRECPLUGINEngine/CANRECPluginEngine.hxx new file mode 100644 index 0000000..4db53ec --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginEngine.hxx @@ -0,0 +1,33 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINENGINE_HXX) +#define __CANRECPLUGINENGINE_HXX + +#ifdef WIN32 + #if defined CANRECPLUGINENGINE_EXPORTS || defined CANRECPluginEngine_EXPORTS + #define CANRECPLUGINENGINE_EXPORT __declspec( dllexport ) + #else + #define CANRECPLUGINENGINE_EXPORT __declspec( dllimport ) + #endif +#else + #define CANRECPLUGINENGINE_EXPORT +#endif + +#endif // __CANRECPLUGINENGINE_HXX diff --git a/src/CANRECPLUGINEngine/CANRECPluginEngine_IOperations_i.cc b/src/CANRECPLUGINEngine/CANRECPluginEngine_IOperations_i.cc new file mode 100644 index 0000000..e6b3b6e --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginEngine_IOperations_i.cc @@ -0,0 +1,76 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "CANRECPluginEngine_IOperations_i.hh" +#include "CANRECPluginImpl_IOperations.hxx" + +#include + +CANRECPluginEngine_IOperations_i::CANRECPluginEngine_IOperations_i( PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + CANRECPluginImpl_IOperations* theImpl ) + : GEOM_IOperations_i( thePOA, theEngine, theImpl ) +{ + MESSAGE( "CANRECPluginEngine_IOperations_i::CANRECPluginEngine_IOperations_i()" ); +} + +CANRECPluginEngine_IOperations_i::~CANRECPluginEngine_IOperations_i() +{ + MESSAGE( "CANRECPluginEngine_IOperations_i::~CANRECPluginEngine_IOperations_i()" ); +} + +//============================================================================= +/*! + * Create a canonical recognition for the object + * \param theMergeSurf set merging surfaces + * \param theMergeCurves set merging curves + * \param theTolerance set tolerance + * \param theObject is initial object + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +GEOM::GEOM_Object_ptr +CANRECPluginEngine_IOperations_i::MakeCanonicalRecognition( GEOM::GEOM_Object_ptr theObject, + CORBA::Boolean theMergeSurf, + CORBA::Boolean theMergeCurves, + CORBA::Double theTolerance ) +{ + // Set a not done flag + GetOperations()->SetNotDone(); + + // Get the reference points + Handle(GEOM_Object) anInitObject = GetObjectImpl( theObject ); + + if ( anInitObject.IsNull() ) return GEOM::GEOM_Object::_nil(); + + // Make Canonical Recognition + Handle(GEOM_Object) anObject = GetOperations()->MakeCanonicalRecognition( anInitObject, + theMergeSurf, + theMergeCurves, + theTolerance ); + if ( !GetOperations()->IsDone() || anObject.IsNull() ) + return GEOM::GEOM_Object::_nil(); + + return GetObject( anObject ); +} + +::CANRECPluginImpl_IOperations* CANRECPluginEngine_IOperations_i::GetOperations() +{ + return (::CANRECPluginImpl_IOperations*)GetImpl(); +} diff --git a/src/CANRECPLUGINEngine/CANRECPluginEngine_IOperations_i.hh b/src/CANRECPLUGINEngine/CANRECPluginEngine_IOperations_i.hh new file mode 100644 index 0000000..419c2c0 --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginEngine_IOperations_i.hh @@ -0,0 +1,51 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINENGINE_IOPERATIONS_HH) +#define __CANRECPLUGINENGINE_IOPERATIONS_HH + +#include +#include CORBA_CLIENT_HEADER(GEOM_Gen) +#include CORBA_SERVER_HEADER(CANRECPlugin) + +#include "CANRECPluginEngine.hxx" + +#include + +class CANRECPluginImpl_IOperations; + +class CANRECPLUGINENGINE_EXPORT CANRECPluginEngine_IOperations_i : + public virtual POA_CANRECPlugin::ICanRecOperations, + public virtual GEOM_IOperations_i +{ + public: + CANRECPluginEngine_IOperations_i( PortableServer::POA_ptr thePOA, + GEOM::GEOM_Gen_ptr theEngine, + CANRECPluginImpl_IOperations* theImpl ); + ~CANRECPluginEngine_IOperations_i(); + + GEOM::GEOM_Object_ptr MakeCanonicalRecognition ( GEOM::GEOM_Object_ptr theObject, + CORBA::Boolean theMergeSurf, + CORBA::Boolean theMergeCurves, + CORBA::Double theTolerance ); + + CANRECPluginImpl_IOperations* GetOperations(); +}; + +#endif // __CANRECPLUGINENGINE_IOPERATIONS_HH diff --git a/src/CANRECPLUGINEngine/CANRECPluginEngine_OperationsCreator.cc b/src/CANRECPLUGINEngine/CANRECPluginEngine_OperationsCreator.cc new file mode 100644 index 0000000..8a78b2a --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginEngine_OperationsCreator.cc @@ -0,0 +1,58 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include "CANRECPluginEngine_OperationsCreator.hh" +#include "CANRECPluginEngine_IOperations_i.hh" +#include "CANRECPluginImpl_IOperations.hxx" +#include "CANRECPluginImpl_Driver.hxx" + +#include + +#include + +std::map CANRECPluginEngine_OperationsCreator::_mapOfOperations; + +CANRECPluginEngine_OperationsCreator::CANRECPluginEngine_OperationsCreator() +{ + // Register drivers + TFunction_DriverTable::Get()->AddDriver( CANRECPluginImpl_Driver::GetID(), + new CANRECPluginImpl_Driver() ); +} + +CANRECPluginEngine_OperationsCreator::~CANRECPluginEngine_OperationsCreator() +{ +} + +GEOM_IOperations_i* CANRECPluginEngine_OperationsCreator::Create( PortableServer::POA_ptr thePOA, + int theStudyId, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_Gen* theGenImpl ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "CANRECPluginEngine_OperationsCreator::Create" ); + return new CANRECPluginEngine_IOperations_i( thePOA, theEngine, get( theGenImpl, theStudyId ) ); +} + +CANRECPluginImpl_IOperations* CANRECPluginEngine_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl, + int theStudyId ) +{ + + if ( _mapOfOperations.find( theStudyId ) == _mapOfOperations.end() ) + _mapOfOperations[theStudyId] = new CANRECPluginImpl_IOperations( theGenImpl, theStudyId ); + return _mapOfOperations[theStudyId]; +} diff --git a/src/CANRECPLUGINEngine/CANRECPluginEngine_OperationsCreator.hh b/src/CANRECPLUGINEngine/CANRECPluginEngine_OperationsCreator.hh new file mode 100644 index 0000000..91c4f52 --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginEngine_OperationsCreator.hh @@ -0,0 +1,49 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#if !defined(__CANRECPLUGINENGINE_OPERATIONSCREATOR_HH) +#define __CANRECPLUGINENGINE_OPERATIONSCREATOR_HH + +#include "CANRECPluginEngine.hxx" +#include +#include + +class GEOMImpl_Gen; +class CANRECPluginImpl_IOperations; + +//===================================================================== +// Operations creator +//===================================================================== +class CANRECPLUGINENGINE_EXPORT CANRECPluginEngine_OperationsCreator : public GEOM_GenericOperationsCreator +{ +public: + CANRECPluginEngine_OperationsCreator(); + ~CANRECPluginEngine_OperationsCreator(); + + virtual GEOM_IOperations_i* Create ( PortableServer::POA_ptr thePOA, + int theStudyId, + GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_Gen* theGenImpl ); +private: + static CANRECPluginImpl_IOperations* get( ::GEOMImpl_Gen* theGenImpl, + int theStudyId ); + + static std::map _mapOfOperations; +}; + +#endif // __CANRECPLUGINENGINE_OPERATIONSCREATOR_HH diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_Driver.cxx b/src/CANRECPLUGINEngine/CANRECPluginImpl_Driver.cxx new file mode 100644 index 0000000..107776d --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_Driver.cxx @@ -0,0 +1,142 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include "CANRECPluginImpl_Driver.hxx" +#include "CANRECPluginImpl_Types.hxx" +#include "CANRECPluginImpl_ICanRec.hxx" + +#include + +#include +#include +#include +#include +#include +#include + +#ifdef CANREC_HASLICENSE +#include "CANRECPluginImpl_license.h" +#include +#include +#endif // CANREC_HASLICENSE + +const Standard_GUID& CANRECPluginImpl_Driver::GetID() +{ + static Standard_GUID aGUID("7e1492bb-b4cd-4a40-ad8f-102902b0047e"); + return aGUID; +} + +CANRECPluginImpl_Driver::CANRECPluginImpl_Driver() +{ +} + +CANRECPluginImpl_Driver::~CANRECPluginImpl_Driver() +{ +} + +Standard_Boolean CANRECPluginImpl_Driver::MustExecute( const TFunction_Logbook& ) const +{ + return Standard_True; +} + +void CANRECPluginImpl_Driver::Validate( TFunction_Logbook& ) const +{ +} + +Standard_Integer CANRECPluginImpl_Driver::Execute( TFunction_Logbook& log ) const +{ + if ( Label().IsNull() ) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction( Label() ); + + CANRECPluginImpl_ICanRec aData( aFunction ); + + // Getting data + bool isNeedMergeSurf = aData.GetNeedMergeSurf(); + bool isNeedMergeCurves = aData.GetNeedMergeCurves(); + double aTolerance = aData.GetTolerance(); + Handle(GEOM_Function) anObject = aData.GetObject(); + TopoDS_Shape aShape = anObject->GetValue(); + +#ifdef CANREC_HASLICENSE + try { + OCCLicense_Activate( "CANREC-"OCC_VERSION_STRING, CANREC_LICENSE ); + } + catch (Standard_LicenseError) { + return 0; + } +#endif // CANREC_HASLICENSE + + ShapeConvert_CanonicAPI aRecognizer; + aRecognizer.Tolerance() = aTolerance; + aRecognizer.SurfaceMode() = isNeedMergeSurf; + aRecognizer.CurveMode() = isNeedMergeCurves; + + // 1. Recognizing + aRecognizer.SetShape( aShape ); + aRecognizer.UnifyMode() = false; + aRecognizer.Perform(); + TopoDS_Shape aResultingShape = aRecognizer.Shape(); + + // 2. Sewing + BRepOffsetAPI_Sewing aSewing( aTolerance ); + aSewing.Add( aResultingShape ); + aSewing.Perform(); + aResultingShape = aSewing.SewedShape(); + + // 3.1. Union Surfaces + if ( isNeedMergeSurf ) { + ShapeConvert_UnionFaces aFaceUnifier; + aFaceUnifier.GetTolerance() = aTolerance; + aResultingShape = aFaceUnifier.Perform( aResultingShape ); + } + + // 3.2. Union Curves + if ( isNeedMergeCurves ) { + ShapeConvert_UnionEdges anEdgeUnifier; + aResultingShape = anEdgeUnifier.Perform( aResultingShape, aTolerance ); + } + + if ( aResultingShape.IsNull() ) return 0; + + aFunction->SetValue( aResultingShape ); + + log.SetTouched( Label() ); + + return 1; +} + +bool CANRECPluginImpl_Driver:: +GetCreationInformation( std::string& theOperationName, + std::vector& theParams ) +{ + if ( Label().IsNull() ) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction( Label() ); + + CANRECPluginImpl_ICanRec aCI( aFunction ); + + theOperationName = "CANONICALRECOGNITION"; + AddParam( theParams, PLUGIN_NAME, "CANRECPlugin" ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + AddParam( theParams, "Merge Surfaces", aCI.GetNeedMergeSurf() ); + AddParam( theParams, "Merge Curves", aCI.GetNeedMergeCurves() ); + + return true; +} + +IMPLEMENT_STANDARD_HANDLE( CANRECPluginImpl_Driver, GEOM_BaseDriver ); +IMPLEMENT_STANDARD_RTTIEXT( CANRECPluginImpl_Driver, GEOM_BaseDriver ); diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_Driver.hxx b/src/CANRECPLUGINEngine/CANRECPluginImpl_Driver.hxx new file mode 100644 index 0000000..68266ba --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_Driver.hxx @@ -0,0 +1,44 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINIMPL_DRIVER_HXX) +#define __CANRECPLUGINIMPL_DRIVER_HXX + +#include + +DEFINE_STANDARD_HANDLE( CANRECPluginImpl_Driver, GEOM_BaseDriver ); + +class CANRECPluginImpl_Driver : public GEOM_BaseDriver +{ +public: + CANRECPluginImpl_Driver(); + ~CANRECPluginImpl_Driver(); + + static const Standard_GUID& GetID(); + virtual Standard_Integer Execute( TFunction_Logbook& ) const; + Standard_Boolean MustExecute( const TFunction_Logbook& ) const; + virtual void Validate( TFunction_Logbook& ) const; + + virtual bool GetCreationInformation( std::string&, + std::vector& ); + + DEFINE_STANDARD_RTTI( CANRECPluginImpl_Driver ); +}; + +#endif // __CANRECPLUGINIMPL_DRIVER_HXX diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_ICanRec.hxx b/src/CANRECPLUGINEngine/CANRECPluginImpl_ICanRec.hxx new file mode 100644 index 0000000..111aa48 --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_ICanRec.hxx @@ -0,0 +1,51 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINIMPL_ICANREC_HXX) +#define __CANRECPLUGINIMPL_ICANREC_HXX + +#include + +#define CanonicalRecognition_ARG_NeedMergeSurf 1 +#define CanonicalRecognition_ARG_NeedMergeCurves 2 +#define CanonicalRecognition_ARG_Tolerance 3 +#define CanonicalRecognition_ARG_Object 4 + +class CANRECPluginImpl_ICanRec +{ +public: + CANRECPluginImpl_ICanRec(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetNeedMergeSurf(bool theMergeSurf) { _func->SetInteger(CanonicalRecognition_ARG_NeedMergeSurf, (int)theMergeSurf); } + bool GetNeedMergeSurf() { return (bool)_func->GetInteger(CanonicalRecognition_ARG_NeedMergeSurf); } + + void SetNeedMergeCurves(bool theCurves) { _func->SetInteger(CanonicalRecognition_ARG_NeedMergeCurves, (int)theCurves); } + bool GetNeedMergeCurves() { return (bool)_func->GetInteger(CanonicalRecognition_ARG_NeedMergeCurves); } + + void SetTolerance(double theTolerance) { _func->SetReal(CanonicalRecognition_ARG_Tolerance, theTolerance); } + double GetTolerance() { return _func->GetReal(CanonicalRecognition_ARG_Tolerance); } + + void SetObject(Handle(GEOM_Function) anInitialObject) { _func->SetReference(CanonicalRecognition_ARG_Object, anInitialObject); } + Handle(GEOM_Function) GetObject() { return _func->GetReference(CanonicalRecognition_ARG_Object); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // __CANRECPLUGINIMPL_ICANREC_HXX diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_IOperations.cxx b/src/CANRECPLUGINEngine/CANRECPluginImpl_IOperations.cxx new file mode 100644 index 0000000..9fdb532 --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_IOperations.cxx @@ -0,0 +1,103 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "CANRECPluginImpl_IOperations.hxx" +#include "CANRECPluginImpl_Driver.hxx" +#include "CANRECPluginImpl_ICanRec.hxx" +#include "CANRECPluginImpl_Types.hxx" + +#include + +#include + +#include + +CANRECPluginImpl_IOperations::CANRECPluginImpl_IOperations( GEOM_Engine* theEngine, int theDocID) + : GEOM_IOperations( theEngine, theDocID ) +{ + MESSAGE( "CANRECPluginImpl_IOperations::CANRECPluginImpl_IOperations()" ); +} + +CANRECPluginImpl_IOperations::~CANRECPluginImpl_IOperations() +{ + MESSAGE( "CANRECPluginImpl_IOperations::~CANRECPluginImpl_IOperations()" ); +} + +//============================================================================= +/*! + * Create a canonical recognition for the object + * \param theMergeSurf set merging surfaces + * \param theMergeCurves set merging curves + * \param theTolerance set tolerance + * \param theObject is initial object + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +Handle(GEOM_Object) +CANRECPluginImpl_IOperations::MakeCanonicalRecognition ( Handle(GEOM_Object) theObject, + bool theMergeSurf, + bool theMergeCurves, + double theTolerance ) +{ + SetErrorCode( KO ); + + if ( theObject.IsNull() ) return NULL; + + // Add a new object + Handle(GEOM_Object) aShape = GetEngine()->AddObject( GetDocID(), GEOM_CANONICALRECOGNITION ); + + // Add a new shape function with parameters + Handle(GEOM_Function) aFunction = aShape->AddFunction( CANRECPluginImpl_Driver::GetID(), CANONICALRECOGNITION_OBJ ); + if ( aFunction.IsNull() ) return NULL; + + // Check if the function is set correctly + if ( aFunction->GetDriverGUID() != CANRECPluginImpl_Driver::GetID() ) return NULL; + + Handle(GEOM_Function) aRefFunction = theObject->GetLastFunction(); + + if ( aRefFunction.IsNull() ) return NULL; + + CANRECPluginImpl_ICanRec aData( aFunction ); + aData.SetNeedMergeSurf( theMergeSurf ); + aData.SetNeedMergeCurves( theMergeCurves ); + aData.SetTolerance( theTolerance ); + aData.SetObject( aRefFunction ); + + // Compute the resulting value + try { + OCC_CATCH_SIGNALS; + if ( !GetSolver()->ComputeFunction( aFunction ) ) { + SetErrorCode( "Canonical Recognition driver failed" ); + return NULL; + } + } + catch ( Standard_Failure ) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode( aFail->GetMessageString() ); + return NULL; + } + + // Make a Python command + GEOM::TPythonDump(aFunction) << aShape << " = " << "geompy.MakeCanonicalRecognition(" << + theObject << ", " << theMergeSurf << ", " << theMergeCurves << ", " << theTolerance << ")"; + + SetErrorCode( OK ); + + return aShape; +} diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_IOperations.hxx b/src/CANRECPLUGINEngine/CANRECPluginImpl_IOperations.hxx new file mode 100644 index 0000000..2d7ba11 --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_IOperations.hxx @@ -0,0 +1,40 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINIMPL_IOPERATIONS_HXX) +#define __CANRECPLUGINIMPL_IOPERATIONS_HXX + +#include +#include + +class GEOM_Engine; + +class CANRECPluginImpl_IOperations: public GEOM_IOperations +{ +public: + Standard_EXPORT CANRECPluginImpl_IOperations( GEOM_Engine* theEngine, int theDocID ); + Standard_EXPORT ~CANRECPluginImpl_IOperations(); + + Standard_EXPORT Handle(GEOM_Object) MakeCanonicalRecognition ( Handle(GEOM_Object) theObject, + bool theMergeSurf, + bool theMergeCurves, + double theTolerance ); +}; + +#endif // __CANRECPLUGINIMPL_IOPERATIONS_HXX diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_Types.hxx b/src/CANRECPLUGINEngine/CANRECPluginImpl_Types.hxx new file mode 100644 index 0000000..59b986d --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_Types.hxx @@ -0,0 +1,30 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#if !defined(__CANRECPLUGINIMPL_TYPES_HXX) +#define __CANRECPLUGINIMPL_TYPES_HXX + +#include + +// Canonical Recognition functions +#define GEOM_CANONICALRECOGNITION (USER_TYPE_EX + 1) + +// Canonical Recognition sub-operations codes +#define CANONICALRECOGNITION_OBJ 1 + +#endif // __CANRECPLUGINIMPL_TYPES_HXX diff --git a/src/CANRECPLUGINEngine/CANRECPluginImpl_license.h.in b/src/CANRECPLUGINEngine/CANRECPluginImpl_license.h.in new file mode 100644 index 0000000..a527c36 --- /dev/null +++ b/src/CANRECPLUGINEngine/CANRECPluginImpl_license.h.in @@ -0,0 +1,25 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINIMPL_LICENSE_H) +#define __CANRECPLUGINIMPL_LICENSE_H + +#define CANREC_LICENSE "@CANREC_LICENSE@" + +#endif // __CANRECPLUGINIMPL_LICENSE_H diff --git a/src/CANRECPLUGINEngine/CMakeLists.txt b/src/CANRECPLUGINEngine/CMakeLists.txt new file mode 100644 index 0000000..56e120a --- /dev/null +++ b/src/CANRECPLUGINEngine/CMakeLists.txt @@ -0,0 +1,81 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# --- options --- + +# additional include directories +INCLUDE_DIRECTORIES( + ${CAS_INCLUDE_DIRS} + ${CR_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIR} + ${KERNEL_INCLUDE_DIRS} + ${GEOM_INCLUDE_DIRS} + ${PROJECT_BINARY_DIR} + ${PROJECT_BINARY_DIR}/idl + ${CMAKE_CURRENT_BINARY_DIR} + ) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${CAS_DEFINITIONS} + ${OMNIORB_DEFINITIONS} + ) + +# libraries to link to +SET(_link_LIBRARIES + ${CR_LIBRARIES} + ${KERNEL_SALOMEBasics} + ${KERNEL_SALOMELocalTrace} + ${KERNEL_OpUtil} + ${GEOM_SalomeIDLGEOM} + ${GEOM_GEOMEngine} + SalomeIDLCANRECPlugin + ) + +# --- headers --- + +SET(CANRECPluginEngine_HEADERS + CANRECPluginEngine.hxx + CANRECPluginEngine_IOperations_i.hh + CANRECPluginEngine_OperationsCreator.hh + CANRECPluginImpl_Driver.hxx + CANRECPluginImpl_ICanRec.hxx + CANRECPluginImpl_IOperations.hxx + CANRECPluginImpl_Types.hxx + ) +# --- sources --- + +SET(CANRECPluginEngine_SOURCES + CANRECPluginEngine.cxx + CANRECPluginEngine_IOperations_i.cc + CANRECPluginEngine_OperationsCreator.cc + CANRECPluginImpl_Driver.cxx + CANRECPluginImpl_IOperations.cxx + ) + +# --- rules --- + +ADD_LIBRARY(CANRECPluginEngine ${CANRECPluginEngine_SOURCES}) +TARGET_LINK_LIBRARIES(CANRECPluginEngine ${_link_LIBRARIES}) +INSTALL(TARGETS CANRECPluginEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${CANRECPluginEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) + +# configure license file +CONFIGURE_FILE(CANRECPluginImpl_license.h.in CANRECPluginImpl_license.h) diff --git a/src/CANRECPLUGINGUI/CANRECPluginGUI.cxx b/src/CANRECPLUGINGUI/CANRECPluginGUI.cxx new file mode 100644 index 0000000..e901115 --- /dev/null +++ b/src/CANRECPLUGINGUI/CANRECPluginGUI.cxx @@ -0,0 +1,98 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "CANRECPluginGUI.h" +#include "CANRECPluginGUI_CanonicalRecognitionDlg.h" + +#include + +#include +#include + +//======================================================================= +// function : CANRECPluginGUI() +// purpose : Constructor +//======================================================================= +CANRECPluginGUI::CANRECPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent ) +{ +} + +//======================================================================= +// function : ~CANRECPluginGUI +// purpose : Destructor +//======================================================================= +CANRECPluginGUI::~CANRECPluginGUI() +{ +} + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool CANRECPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) +{ + QString cmd; + switch ( theCommandID ) { + case 1: + cmd = "CanonicalRecognition"; + default: + break; + } + return OnGUIEvent( cmd, parent ); +} + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool CANRECPluginGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent ) +{ + SalomeApp_Application* app = getGeometryGUI()->getApp(); + if ( !app ) return false; + + getGeometryGUI()->EmitSignalDeactivateDialog(); + + QDialog* aDlg = 0; + + if ( theCommandID == "CanonicalRecognition" ) { + aDlg = new CANRECPluginGUI_CanonicalRecognitionDlg( getGeometryGUI(), parent ); + } + else { + app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + } + + if ( aDlg ) + aDlg->show(); + + return true; +} + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ +#ifdef WIN32 + __declspec( dllexport ) +#endif + GEOMGUI* GetLibGUI( GeometryGUI* parent ) + { + return new CANRECPluginGUI( parent ); + } +} diff --git a/src/CANRECPLUGINGUI/CANRECPluginGUI.h b/src/CANRECPLUGINGUI/CANRECPluginGUI.h new file mode 100644 index 0000000..a544915 --- /dev/null +++ b/src/CANRECPLUGINGUI/CANRECPluginGUI.h @@ -0,0 +1,37 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINGUI_H) +#define __CANRECPLUGINGUI_H + +#include + +class GeometryGUI; + +class CANRECPluginGUI : public GEOMPluginGUI +{ +public: + CANRECPluginGUI( GeometryGUI* ); + ~CANRECPluginGUI(); + + bool OnGUIEvent( int, SUIT_Desktop* ); + bool OnGUIEvent( const QString&, SUIT_Desktop* ); +}; + +#endif // __CANRECPLUGINGUI_H diff --git a/src/CANRECPLUGINGUI/CANRECPluginGUI_CanonicalRecognitionDlg.cxx b/src/CANRECPLUGINGUI/CANRECPluginGUI_CanonicalRecognitionDlg.cxx new file mode 100644 index 0000000..8de9222 --- /dev/null +++ b/src/CANRECPLUGINGUI/CANRECPluginGUI_CanonicalRecognitionDlg.cxx @@ -0,0 +1,311 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "CANRECPluginGUI_CanonicalRecognitionDlg.h" + +// Geometry includes +#include +#include +#include +#include +#include + +# //GUI inludes +#include +#include +#include +#include +#include +#include +#include +#include + +// OCCT Include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include + +#include +#include CORBA_CLIENT_HEADER(CANRECPlugin) + +//================================================================================= +// Constructor +//================================================================================= +CANRECPluginGUI_CanonicalRecognitionDlg::CANRECPluginGUI_CanonicalRecognitionDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) +: GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + QString aPluginName = "CANRECPlugin"; + QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap( aPluginName, tr( "ICO_CANONICALRECOGNITION" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( aPluginName, tr( "ICON_SELECT" ) ) ); + + setWindowTitle(tr("CANONICALRECOGNITION_CANONICALRECOGNITION_TITLE")); + + /***************************************************************/ + + mainFrame()->GroupConstructors->setTitle(tr("GEOM_CANONICALRECOGNITION")); + mainFrame()->RadioButton1->setIcon(imageOp); + + //Hide second and third radio buttons + + mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton2->close(); + + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); + mainFrame()->RadioButton3->close(); + + //Arguments + QGroupBox* argGroup = new QGroupBox( tr( "CANRECPLUGIN_ARGUMENTS" ), this ); + QGridLayout* lay = new QGridLayout( argGroup ); + + // Object selector + LineEdit1 = new QLineEdit( argGroup ); + LineEdit1->setReadOnly( true ); + PButton1 = new QPushButton( argGroup ); + PButton1->setIcon( image1 ); + PButton1->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + + // 2. Object + QLabel* textLabel1 = new QLabel( argGroup ); + textLabel1->setText( tr( "CANRECPLUGIN_ARG_OBJ" ) ); + + // 3. Tolerance + QLabel* textLabel2 = new QLabel( argGroup ); + textLabel2->setText( tr( "CANRECPLUGIN_ARG_TOLERANCE" ) ); + SpinBoxTol = new SalomeApp_DoubleSpinBox( argGroup ); + SpinBoxTol->setValue( 0.01 ); + initSpinBox(SpinBoxTol, COORD_MIN, COORD_MAX, 0.001, "length_precision" ); + + // 4. Merge sufrace flag + CheckButton1 = new QCheckBox( argGroup ); + CheckButton1->setText( tr( "CANRECPLUGIN_ARG_MERGE_SURF" ) ); + CheckButton1->setChecked( true ); + + // 5. Merge curves flag + CheckButton2 = new QCheckBox( argGroup ); + CheckButton2->setText( tr( "CANRECPLUGIN_ARG_MERGE_CURVES" ) ); + CheckButton2->setChecked( true ); + + lay->addWidget( textLabel1, 0, 0 ); + lay->addWidget( PButton1, 0, 1 ); + lay->addWidget( LineEdit1, 0, 2 ); + + lay->addWidget( textLabel2, 1, 0, 1, 2 ); + lay->addWidget( SpinBoxTol, 1, 2 ); + + lay->addWidget( CheckButton1, 2, 0, 1, 3 ); + lay->addWidget( CheckButton2, 3, 0, 1, 3 ); + + myHelpFileName = "canrecplugin_usage_page.html"; + myHelpContext = aPluginName.toUpper(); + + QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); + layout->setMargin(0); layout->setSpacing(6); + layout->addWidget( argGroup ); + + Init(); +} + +//================================================================================= +// Destructor +//================================================================================= +CANRECPluginGUI_CanonicalRecognitionDlg::~CANRECPluginGUI_CanonicalRecognitionDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::Init() +{ + // Get setting of step value from file configuration + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); + + // Signal/slot connections + connect( buttonOk(), SIGNAL( clicked() ),this, SLOT( ClickOnOk() ) ); + connect( buttonApply(), SIGNAL( clicked() ),this, SLOT( ClickOnApply() ) ); + connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), + this, SLOT( SetDoubleSpinBoxStep( double ) ) ); + connect( myGeomGUI->getApp()->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + initName( tr( "GEOM_CANONICALRECOGNITION_NAME" ) ); + SelectionIntoArgument(); +} + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::ClickOnOk() +{ + if ( ClickOnApply() ) + ClickOnCancel(); +} + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::ClickOnCancel() +{ + close(); +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +bool CANRECPluginGUI_CanonicalRecognitionDlg::ClickOnApply() +{ + if ( !onAccept() ) + return false; + initName(); + return true; +} + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + + connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( SelectionIntoArgument() ) ); + SelectionIntoArgument(); +} + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::enterEvent (QEvent*) +{ + if ( !isEnabled() ) + ActivateThisDialog(); +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr CANRECPluginGUI_CanonicalRecognitionDlg::createOperation() +{ + return getGeomEngine()->GetPluginOperations( getStudyId(), "CANRECPluginEngine" ); +} + +//================================================================================= +// function : isValid +// purpose : +//================================================================================= +bool CANRECPluginGUI_CanonicalRecognitionDlg::isValid( QString& msg ) +{ + bool ok = true; + return ok; +} + +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool CANRECPluginGUI_CanonicalRecognitionDlg::execute( ObjectList& objects ) +{ + bool res = false; + + GEOM::GEOM_Object_var anObj; + + CANRECPlugin::ICanRecOperations_var anOper = CANRECPlugin::ICanRecOperations::_narrow( getOperation() ); + CORBA::Boolean aMergeSurf = CheckButton1->isChecked(); + CORBA::Boolean aMergeCurves = CheckButton2->isChecked(); + CORBA::Double aTolerance = SpinBoxTol->value(); + + // call engine function + anObj = anOper->MakeCanonicalRecognition( myObject.get(), aMergeSurf, aMergeCurves, aTolerance ); + res = !anObj->_is_nil(); + if ( res && !IsPreview() ) + { + QStringList aParameters; + aParameters << QString( CheckButton1->isChecked() ); + aParameters << QString( CheckButton2->isChecked() ); + aParameters << QString::number( SpinBoxTol->value() ); + aParameters << myObject->GetName(); + + if ( aParameters.count() > 0 ) + anObj->SetParameters( aParameters.join(":").toLatin1().constData() ); + } + + if ( res ) + objects.push_back( anObj._retn() ); + + return res; +} + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::SelectionIntoArgument() +{ + QList aTypes; + aTypes << TopAbs_SOLID << TopAbs_COMPOUND << TopAbs_COMPSOLID << TopAbs_SHELL; + QList selected = getSelected( aTypes, -1 ); + if ( !selected.isEmpty() ) + { + myObject = selected.first(); + LineEdit1->setText( myObject->GetName() ); + } + else + LineEdit1->setText( "" ); +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::SetEditCurrentArgument() +{ + if ( sender() == PButton1 ) + LineEdit1->setFocus(); + SelectionIntoArgument(); +} +//================================================================================= +// function : SetDoubleSpinBoxStep() +// purpose : Double spin box management +//================================================================================= +void CANRECPluginGUI_CanonicalRecognitionDlg::SetDoubleSpinBoxStep( double step ) +{ + SpinBoxTol->setSingleStep( step ); +} diff --git a/src/CANRECPLUGINGUI/CANRECPluginGUI_CanonicalRecognitionDlg.h b/src/CANRECPLUGINGUI/CANRECPluginGUI_CanonicalRecognitionDlg.h new file mode 100644 index 0000000..15ae7a5 --- /dev/null +++ b/src/CANRECPLUGINGUI/CANRECPluginGUI_CanonicalRecognitionDlg.h @@ -0,0 +1,70 @@ +// Copyright (C) 2014-2015 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#if !defined(__CANRECPLUGINGUI_CANONICALRECONGNITION_H) +#define __CANRECPLUGINGUI_CANONICALRECONGNITION_H + +#include +#include + +class GeometryGUI; +class SalomeApp_DoubleSpinBox; +class QCheckBox; +class QPushButton; +class QLineEdit; +class QGroupBox; + +class CANRECPluginGUI_CanonicalRecognitionDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + CANRECPluginGUI_CanonicalRecognitionDlg( GeometryGUI*, QWidget* = 0 ); + ~CANRECPluginGUI_CanonicalRecognitionDlg(); + +protected: + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid( QString& ); + virtual bool execute( ObjectList& ); + +private: + void Init(); + void enterEvent( QEvent* ); + +private slots: + void ClickOnOk(); + virtual void ClickOnCancel(); + bool ClickOnApply(); + + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void SetDoubleSpinBoxStep( double ); + +private: + QLineEdit* LineEdit1; + QPushButton* PButton1; + SalomeApp_DoubleSpinBox* SpinBoxTol; + QCheckBox* CheckButton1; + QCheckBox* CheckButton2; + + GEOM::GeomObjPtr myObject; +}; + +#endif // __CANRECPLUGINGUI_CANONICALRECONGNITION_H diff --git a/src/CANRECPLUGINGUI/CMakeLists.txt b/src/CANRECPLUGINGUI/CMakeLists.txt new file mode 100644 index 0000000..3d3cf4d --- /dev/null +++ b/src/CANRECPLUGINGUI/CMakeLists.txt @@ -0,0 +1,103 @@ + # Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +INCLUDE(UseQt4Ext) +INCLUDE(${QT_USE_FILE}) + +# --- options --- +# additional include directories +INCLUDE_DIRECTORIES( + ${CAS_INCLUDE_DIRS} + ${QT_INCLUDES} + ${OMNIORB_INCLUDE_DIR} + ${PYTHON_INCLUDES} + ${KERNEL_INCLUDE_DIRS} + ${GUI_INCLUDE_DIRS} + ${GEOM_INCLUDE_DIRS} + ${PROJECT_BINARY_DIR}/idl +) + +# additional preprocessor / compiler flags +ADD_DEFINITIONS( + ${CAS_DEFINITIONS} + ${QT_DEFINITIONS} + ${OMNIORB_DEFINITIONS} + ${GUI_DEFINITIONS} +) + +# libraries to link to +SET(_link_LIBRARIES +# ${GUI_SalomeApp} +# ${GUI_qtx} +# ${GUI_suit} +# ${GUI_SalomeObject} +# ${GUI_LightApp} +# ${CAS_KERNEL} +# ${GEOM_GEOM} + ${GEOM_GEOMBase} + SalomeIDLCANRECPlugin +) + +# --- headers --- + +# header files / to be processed by moc +SET(_moc_HEADERS + CANRECPluginGUI_CanonicalRecognitionDlg.h +) + +# header files / no moc processed +SET(_other_HEADERS + CANRECPluginGUI.h +) + +SET(CANRECPluginGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) + +# --- sources --- + +# sources / moc wrappings +QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + +# sources / static +SET(_other_SOURCES + CANRECPluginGUI.cxx + CANRECPluginGUI_CanonicalRecognitionDlg.cxx +) + +# --- resources --- + +# resource files / to be processed by lrelease +SET(_ts_RESOURCES + resources/CANRECPlugin_images.ts + resources/CANRECPlugin_msg_en.ts + resources/CANRECPlugin_msg_fr.ts + resources/CANRECPlugin_msg_ja.ts +) + +# sources / to compile +SET(CANRECPluginGUI_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) + +# --- rules --- + +ADD_LIBRARY(CANRECPluginGUI ${CANRECPluginGUI_SOURCES}) +TARGET_LINK_LIBRARIES(CANRECPluginGUI ${_link_LIBRARIES} ) +INSTALL(TARGETS CANRECPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +INSTALL(FILES ${CANRECPluginGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) + +QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_CANRECPLUGIN_INSTALL_RES_DATA}") diff --git a/src/CANRECPLUGINGUI/resources/CANRECPlugin_images.ts b/src/CANRECPLUGINGUI/resources/CANRECPlugin_images.ts new file mode 100644 index 0000000..b13f825 --- /dev/null +++ b/src/CANRECPLUGINGUI/resources/CANRECPlugin_images.ts @@ -0,0 +1,19 @@ + + + + + @default + + ICON_SELECT + select1.png + + + ICO_CANONICALRECOGNITION + canonicalrecognition.png + + + ICON_OBJBROWSER_1001 + tree_canonicalrecognition.png + + + diff --git a/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_en.ts b/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_en.ts new file mode 100644 index 0000000..fba0e94 --- /dev/null +++ b/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_en.ts @@ -0,0 +1,66 @@ + + + + + @default + + TOP_CANONICALRECOGNITION + Canonical Recognition + + + MEN_CANONICALRECOGNITION + Canonical Recognition + + + STB_CANONICALRECOGNITION + Canonical Recognition + + + + CANRECPluginGUI_CanonicalRecognitionDlg + + CANONICALRECOGNITION_CANONICALRECOGNITION_TITLE + Canonical Recognition Construction + + + GEOM_CANONICALRECOGNITION + Canonical Recognition + + + GEOM_CANONICALRECOGNITION_NAME + Canonical recognition + + + GEOM_CANONICALRECOGNITION_RESULT + Result name + + + GEOM_CANONICALRECOGNITION_ARG + Nodes + + + CANRECPLUGIN_NAME + Name + + + CANRECPLUGIN_ARGUMENTS + Arguments + + + CANRECPLUGIN_ARG_MERGE_SURF + Merge Surfaces + + + CANRECPLUGIN_ARG_MERGE_CURVES + Merge Curves + + + CANRECPLUGIN_ARG_OBJ + Object + + + CANRECPLUGIN_ARG_TOLERANCE + Tolerance + + + diff --git a/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_fr.ts b/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_fr.ts new file mode 100644 index 0000000..dbb4d18 --- /dev/null +++ b/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_fr.ts @@ -0,0 +1,66 @@ + + + + + @default + + TOP_CANONICALRECOGNITION + Canonical Recognition + + + MEN_CANONICALRECOGNITION + Canonical Recognition + + + STB_CANONICALRECOGNITION + Canonical Recognition + + + + CANRECPluginGUI_CanonicalRecognitionDlg + + CANONICALRECOGNITION_CANONICALRECOGNITION_TITLE + Canonical Recognition Construction + + + GEOM_CANONICALRECOGNITION + Canonical Recognition + + + GEOM_CANONICALRECOGNITION_NAME + Canonical recognition + + + GEOM_CANONICALRECOGNITION_RESULT + Result name + + + GEOM_CANONICALRECOGNITION_ARG + Nodes + + + CANRECPLUGIN_NAME + Name + + + CANRECPLUGIN_ARGUMENTS + Arguments + + + CANRECPLUGIN_ARG_MERGE_SURF + Merge Surfaces + + + CANRECPLUGIN_ARG_MERGE_CURVES + Merge Curves + + + CANRECPLUGIN_ARG_OBJ + Object + + + CANRECPLUGIN_ARG_TOLERANCE + Tolerance + + + diff --git a/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_ja.ts b/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_ja.ts new file mode 100644 index 0000000..62d5051 --- /dev/null +++ b/src/CANRECPLUGINGUI/resources/CANRECPlugin_msg_ja.ts @@ -0,0 +1,66 @@ + + + + + @default + + TOP_CANONICALRECOGNITION + Canonical Recognition + + + MEN_CANONICALRECOGNITION + Canonical Recognition + + + STB_CANONICALRECOGNITION + Canonical Recognition + + + + CANRECPluginGUI_CanonicalRecognitionDlg + + CANONICALRECOGNITION_CANONICALRECOGNITION_TITLE + Canonical Recognition Construction + + + GEOM_CANONICALRECOGNITION + Canonical Recognition + + + GEOM_CANONICALRECOGNITION_NAME + Canonical recognition + + + GEOM_CANONICALRECOGNITION_RESULT + Result name + + + GEOM_CANONICALRECOGNITION_ARG + Nodes + + + CANRECPLUGIN_NAME + Name + + + CANRECPLUGIN_ARGUMENTS + Arguments + + + CANRECPLUGIN_ARG_MERGE_SURF + Merge Surfaces + + + CANRECPLUGIN_ARG_MERGE_CURVES + Merge Curves + + + CANRECPLUGIN_ARG_OBJ + Object + + + CANRECPLUGIN_ARG_TOLERANCE + Tolerance + + + diff --git a/src/CANRECPLUGIN_PY/CANRECPluginBuilder.py b/src/CANRECPLUGIN_PY/CANRECPluginBuilder.py new file mode 100644 index 0000000..e4c9c01 --- /dev/null +++ b/src/CANRECPLUGIN_PY/CANRECPluginBuilder.py @@ -0,0 +1,76 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +## +# @package CANRECPluginBuilder +# Python API for the CANRECPLUGIN geometry plug-in module. + +from CANRECPlugin import ICanRecOperations + +# Engine Library Name +__libraryName__ = "CANRECPluginEngine" + +## Get Canonical recognition plugin operations interface +# @return an instance of Canonical recognition plugin operations interface +def GetCANRECOperations(self): + """ + Get Canonical recognition plugin operations interface. + + Returns: + An instance of Canonical recognition plugin operations interface + """ + anOp = self.GetPluginOperations(self.myStudyId, __libraryName__) + return anOp._narrow(ICanRecOperations) + +## Perform, if possible, conversion of NURBS (B-Spline, Bezier) geometry to canonical (analytical) form. +# @param theObj the input object (solid, compound, compsolid). +# @param theMergeSurf the flag to switch on/off merging surfaces in the result shape. +# @param theMergeCurves the flag to switch on/off merging curves in the result shape. +# @param theTolerance the tolerance of the canonical recognition operation. +# @param theName object name when specified, this parameter is used +# for result publication in the study. Otherwise, if automatic +# publication is switched on, default value is used for result name. +# +# @return New GEOM_Object, containing the canonical recognition of the input object. +def MakeCanonicalRecognition(self, theObj, theMergeSurf, theMergeCurves, + theTolerance=0.01, theName=None): + """ + Perform, if possible, conversion of NURBS (B-Spline, Bezier) geometry to canonical (analytical) form. + + Parameters: + theObj the input object (solid, compound, compsolid). + theMergeSurf the flag to switch on/off merging surfaces in the result shape. + theMergeCurves the flag to switch on/off merging curves in the result shape. + theTolerance the tolerance of the canonical recognition operation. + theName object name when specified, this parameter is used + for result publication in the study. Otherwise, if automatic + publication is switched on, default value is used for result name. + + Returns: + New GEOM_Object, containing the canonical recognition of the input object. + """ + from salome.geom.geomBuilder import ParseParameters, RaiseIfFailed + anOp = GetCANRECOperations(self) + theMergeSurf, theMergeCurves, theTolerance, Parameters = ParseParameters(theMergeSurf, theMergeCurves, theTolerance) + anObj = anOp.MakeCanonicalRecognition(theObj, theMergeSurf, theMergeCurves, theTolerance) + RaiseIfFailed("MakeCanonicalRecognition", anOp) + self._autoPublish(anObj, theName, "canonical") + anOp.UnRegister() + return anObj diff --git a/src/CANRECPLUGIN_PY/CMakeLists.txt b/src/CANRECPLUGIN_PY/CMakeLists.txt new file mode 100644 index 0000000..b410ae6 --- /dev/null +++ b/src/CANRECPLUGIN_PY/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# --- scripts --- + +# scripts / static +SET(_scripts + __init__.py + CANRECPluginBuilder.py +) + +# --- rules --- + +# install scripts +SALOME_INSTALL_SCRIPTS("${_scripts}" ${SALOME_INSTALL_PYTHON}/salome/CANRECPlugin DEF_PERMS) diff --git a/src/CANRECPLUGIN_PY/__init__.py b/src/CANRECPLUGIN_PY/__init__.py new file mode 100644 index 0000000..4d80ac4 --- /dev/null +++ b/src/CANRECPLUGIN_PY/__init__.py @@ -0,0 +1,22 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +## +# @package CANRECPLUGINBuilder +# Python API for the CANRECPLUGIN geometry plug-in module. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..13af050 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2014-2015 OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +ADD_SUBDIRECTORY(CANRECPLUGINEngine) +ADD_SUBDIRECTORY(CANRECPLUGIN_PY) +IF(SALOME_BUILD_GUI) + ADD_SUBDIRECTORY(CANRECPLUGINGUI) +ENDIF(SALOME_BUILD_GUI)