X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Point.h;h=e9efd6ab023e4ce7637d0019be600e4491a951c7;hb=2f9cc8a307aeb75f6ee8c2c5c97f90acd5f3d53e;hp=63a13422614b10b26b218487c5657141b14d41fd;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index 63a134226..e9efd6ab0 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -1,52 +1,206 @@ -// 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_H_ #define ConstructionPlugin_Point_H_ #include "ConstructionPlugin.h" + +#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() +public: + /// 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 std::string MY_KIND = CONSTRUCTION_POINT_KIND; - return MY_KIND; + static const std::string MY_CREATION_METHOD_ID("by_projection"); + return MY_CREATION_METHOD_ID; } - /// Returns to which group in the document must be added feature - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup() + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION() { - static std::string MY_GROUP = "Construction"; - return MY_GROUP; + static const std::string MY_CREATION_METHOD_ID("by_lines_intersection"); + return MY_CREATION_METHOD_ID; } - /// Creates a new part document if needed + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION() + { + static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_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 distance. + inline static const std::string& DISTANCE_VALUE() + { + static const std::string ATTR_ID("value"); + return ATTR_ID; + } + + /// Attribute name for percent flag. + inline static const std::string& DISTANCE_PERCENT() + { + static const std::string ATTR_ID("percent"); + 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. + inline static const std::string& POINT() + { + static const std::string ATTR_ID("point"); + return ATTR_ID; + } + + /// Attribute name for plane. + inline static const std::string& PLANE() + { + static const std::string ATTR_ID("plane"); + return ATTR_ID; + } + + /// Attribute name for selected first line. + inline static const std::string& FIRST_LINE() + { + static const std::string ATTR_ID("first_line"); + return ATTR_ID; + } + + /// Attribute name for selected second line. + inline static const std::string& SECOND_LINE() + { + static const std::string ATTR_ID("second_line"); + 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; + }*/ + + /// 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 createByProjection(); + std::shared_ptr createByLinesIntersection(); + std::shared_ptr createByLineAndPlaneIntersection();*/ + }; #endif