X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Point.h;h=49db67df9ab6e6a2db8f6707e59fcc6daf50ef51;hb=e9bc8b0ef4a083909ae41172e6ac891136051c91;hp=a0dda28dd782103e9e37f42c4a77b0b3f6d47979;hpb=91dadfbad133cfb02e4a09adce80ec915d1fc6bd;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index a0dda28dd..49db67df9 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -1,46 +1,321 @@ -// File: ConstructionPlugin_Point.h -// Created: 3 Apr 2014 -// Author: Mikhail PONIKAROV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// 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 ConstructionPlugin_Point_HeaderFile -#define ConstructionPlugin_Point_HeaderFile +#ifndef ConstructionPlugin_Point_H_ +#define ConstructionPlugin_Point_H_ #include "ConstructionPlugin.h" + +#include #include +#include + +#include + +class GeomAPI_Vertex; -/// Point kind -const std::string CONSTRUCTION_POINT_KIND("Point"); - -/// attribute name for X coordinate -const std::string POINT_ATTR_X = "x"; -/// attribute name for Y coordinate -const std::string POINT_ATTR_Y = "y"; -/// attribute name for Z coordinate -const std::string POINT_ATTR_Z = "z"; - -/**\class ConstructionPlugin_Point - * \ingroup DataModel - * \brief Feature for creation of the new part in PartSet. - */ -class ConstructionPlugin_Point: public ModelAPI_Feature +/// \class ConstructionPlugin_Point +/// \ingroup Plugins +/// \brief Feature for creation of the new part in PartSet. +class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: - /// Returns the kind of a feature - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() - {static std::string MY_KIND = CONSTRUCTION_POINT_KIND; return MY_KIND;} + /// Returns the kind of a feature. + CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind(); + + /// Point kind. + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_POINT_KIND("Point"); + return CONSTRUCTION_POINT_KIND; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD() + { + static const std::string MY_CREATION_METHOD_ID("creation_method"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_XYZ() + { + static const std::string MY_CREATION_METHOD_ID("by_xyz"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE() + { + static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_PROJECTION() + { + static const std::string MY_CREATION_METHOD_ID("by_projection"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_INTERSECTION() + { + static const std::string MY_CREATION_METHOD_ID("by_intersection"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for X coordinate. + inline static const std::string& X() + { + static const std::string POINT_ATTR_X("x"); + return POINT_ATTR_X; + } + + /// Attribute name for Y coordinate. + inline static const std::string& Y() + { + static const std::string POINT_ATTR_Y("y"); + return POINT_ATTR_Y; + } + + /// Attribute name for Z coordinate. + inline static const std::string& Z() + { + static const std::string POINT_ATTR_Z("z"); + return POINT_ATTR_Z; + } + + /// Attribute name for selected edge. + inline static const std::string& EDGE() + { + static const std::string ATTR_ID("edge"); + return ATTR_ID; + } + + /// Attribute name for offset type on selected edge. + inline static const std::string& OFFSET_TYPE() + { + static const std::string ATTR_ID("offset_type"); + return ATTR_ID; + } + + /// Attribute name for offset type by distance. + inline static const std::string& OFFSET_TYPE_BY_DISTANCE() + { + static const std::string ATTR_ID("offset_type_by_distance"); + return ATTR_ID; + } + + /// Attribute name for offset type by ratio. + inline static const std::string& OFFSET_TYPE_BY_RATIO() + { + static const std::string ATTR_ID("offset_type_by_ratio"); + return ATTR_ID; + } + + /// Attribute name for distance. + inline static const std::string& DISTANCE() + { + static const std::string ATTR_ID("distance"); + return ATTR_ID; + } + + /// Attribute name for percent flag. + inline static const std::string& RATIO() + { + static const std::string ATTR_ID("ratio"); + return ATTR_ID; + } + + /// Attribute name for reverse flag. + inline static const std::string& REVERSE() + { + static const std::string ATTR_ID("reverse"); + return ATTR_ID; + } + + /// Attribute name for point to projection. + inline static const std::string& POINT_TO_PROJECT() + { + static const std::string ATTR_ID("point_to_project"); + return ATTR_ID; + } + + /// Attribute name for projection type. + inline static const std::string& PROJECTION_TYPE() + { + static const std::string ATTR_ID("projection_type"); + return ATTR_ID; + } - /// Returns to which group in the document must be added feature - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup() - {static std::string MY_GROUP = "Construction"; return MY_GROUP;} + /// Attribute name for projection type on edge. + inline static const std::string& PROJECTION_TYPE_ON_EDGE() + { + static const std::string ATTR_ID("projection_type_on_edge"); + return ATTR_ID; + } - /// Creates a new part document if needed + /// Attribute name for projection type on face. + inline static const std::string& PROJECTION_TYPE_ON_FACE() + { + static const std::string ATTR_ID("projection_type_on_face"); + return ATTR_ID; + } + + /// Attribute name for edge for point projection. + inline static const std::string& EDGE_FOR_POINT_PROJECTION() + { + static const std::string ATTR_ID("edge_for_point_projection"); + return ATTR_ID; + } + + /// Attribute name for face for point projection. + inline static const std::string& FACE_FOR_POINT_PROJECTION() + { + static const std::string ATTR_ID("face_for_point_projection"); + return ATTR_ID; + } + + /// Attribute name for intersection type. + inline static const std::string& INTERSECTION_TYPE() + { + static const std::string ATTR_ID("intersection_type"); + return ATTR_ID; + } + + /// Attribute name for intersection type by lines. + inline static const std::string& INTERSECTION_TYPE_BY_LINES() + { + static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for intersection type by line and plane. + inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE() + { + static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for intersection type by planes. + inline static const std::string& INTERSECTION_TYPE_BY_PLANES() + { + static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for selected first intersection line. + inline static const std::string& INTERSECTION_LINE_1() + { + static const std::string ATTR_ID("intersection_line_1"); + return ATTR_ID; + } + + /// Attribute name for selected second intersection line. + inline static const std::string& INTERSECTION_LINE_2() + { + static const std::string ATTR_ID("intersection_line_2"); + return ATTR_ID; + } + + /// Attribute name for selected intersection line. + inline static const std::string& INTERSECTION_LINE() + { + static const std::string ATTR_ID("intersection_line"); + return ATTR_ID; + } + + /// Attribute name for selected intersection plane. + inline static const std::string& INTERSECTION_PLANE() + { + static const std::string ATTR_ID("intersection_plane"); + return ATTR_ID; + } + + /// Attribute name for use offset for the intersection plane. + inline static const std::string& USE_OFFSET() + { + static const std::string ATTR_ID("use_offset"); + return ATTR_ID; + } + + /// Attribute name for offset for the intersection plane. + inline static const std::string& OFFSET() + { + static const std::string ATTR_ID("offset"); + return ATTR_ID; + } + + /// Attribute name for reverse offset for the intersection plane. + inline static const std::string& REVERSE_OFFSET() + { + static const std::string ATTR_ID("reverse_offset"); + return ATTR_ID; + } + + /// Attribute name for selected intersection plane. + inline static const std::string& INTERSECTION_PLANE_1() + { + static const std::string ATTR_ID("intersection_plane_1"); + return ATTR_ID; + } + + /// Attribute name for selected intersection plane. + inline static const std::string& INTERSECTION_PLANE_2() + { + static const std::string ATTR_ID("intersection_plane_2"); + return ATTR_ID; + } + + /// Attribute name for selected intersection plane. + inline static const std::string& INTERSECTION_PLANE_3() + { + static const std::string ATTR_ID("intersection_plane_3"); + return ATTR_ID; + } + + /// Creates a new part document if needed. CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); - /// Request for initialization of data model of the feature: adding all attributes + /// Request for initialization of data model of the feature: adding all attributes. CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); + /// Construction result is allways recomuted on the fly. + CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} + /// Use plugin manager for features creation ConstructionPlugin_Point(); + + /// Customize presentation of the feature + virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, + std::shared_ptr theDefaultPrs); + +private: + std::shared_ptr createByXYZ(); + std::shared_ptr createByDistanceOnEdge(); + std::shared_ptr createByProjectionOnEdge(); + std::shared_ptr createByProjectionOnFace(); + std::shared_ptr createByLinesIntersection(); + std::list > createByLineAndPlaneIntersection(); + std::shared_ptr createByPlanesIntersection(); }; #endif