X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM%2FGEOM_Object.hxx;h=7b24daa588ab8456b2a908c43db57190b06121f2;hb=14e1a694c4cf249fe205a39c099482bc5b28a6e5;hp=7d8eda71bdde9c29a32249209cf8b876428419ad;hpb=239f8109c64fa0c5a2e1d87a420bad5529b57f48;p=modules%2Fgeom.git diff --git a/src/GEOM/GEOM_Object.hxx b/src/GEOM/GEOM_Object.hxx index 7d8eda71b..7b24daa58 100644 --- a/src/GEOM/GEOM_Object.hxx +++ b/src/GEOM/GEOM_Object.hxx @@ -1,12 +1,14 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // 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. +// 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 +// 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. @@ -17,259 +19,103 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef _GEOM_Object_HeaderFile #define _GEOM_Object_HeaderFile -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_MMgt_TShared_HeaderFile -#include -#endif -#ifndef _MMgt_TShared_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile +#include "GEOM_BaseObject.hxx" + +#include #include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile -#include -#endif -#ifndef _TColStd_HSequenceOfTransient_HeaderFile #include -#endif -#ifndef _TCollection_AsciiString_HeaderFile -#include -#endif +#include +#include -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include -class Handle_TColStd_HSequenceOfTransient; -class Standard_Transient; -class Handle_Standard_Type; -class Handle(MMgt_TShared); class GEOM_Object; +class TFunction_Driver; +class GEOM_Engine; +DEFINE_STANDARD_HANDLE( GEOM_Object, GEOM_BaseObject ) -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Object); - -class Handle(GEOM_Object) : public Handle(MMgt_TShared) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOM_Object)():Handle(MMgt_TShared)() {} - Handle(GEOM_Object)(const Handle(GEOM_Object)& aHandle) : Handle(MMgt_TShared)(aHandle) - { - } - - Handle(GEOM_Object)(const GEOM_Object* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) - { - } - - Handle(GEOM_Object)& operator=(const Handle(GEOM_Object)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOM_Object)& operator=(const GEOM_Object* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOM_Object* operator->() - { - return (GEOM_Object *)ControlAccess(); - } - - GEOM_Object* operator->() const - { - return (GEOM_Object *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOM_Object)() {}; - - Standard_EXPORT static const Handle(GEOM_Object) DownCast(const Handle(Standard_Transient)& AnObject); -}; - - -#include -#include -#include "GEOM_Function.hxx" -#include "GEOM_Engine.hxx" - -class GEOM_Object : public MMgt_TShared +class GEOM_Object : public GEOM_BaseObject { friend class GEOM_Engine; - + public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Object) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { return (STANDARD_TYPE(GEOM_Object) == AType || MMgt_TShared::IsKind(AType)); } + struct Color { + //! Red component of the color + double R; + //! Green component of the color + double G; + //! Blue component of the color + double B; + }; private: GEOM_Object(TDF_Label& theLabel); public: Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType); - Standard_EXPORT ~GEOM_Object() {;} + Standard_EXPORT ~GEOM_Object(); //Finds a GEOM_Object on the label theLabel - Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel); + Standard_EXPORT static Handle(GEOM_Object) GetObject(const TDF_Label& theLabel); //Finds a GEOM_Object by a reference, stored on the label theLabel - Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel); - - //Returns a GEOM_Object common GUID - Standard_EXPORT static const Standard_GUID& GetObjectID(); - - //Returns a GUID associated with a sub shape object - Standard_EXPORT static const Standard_GUID& GetSubShapeID(); + Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(const TDF_Label& theLabel); //########################################################### //Access to properties //########################################################### - //Returns a TreeNode that presents a root of a function tree for this GEOM_Object - Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; } - - //Returns a label of this GEOM_Object - Standard_EXPORT TDF_Label GetEntry() { return _label; } - - //Returns a type of this GEOM_Object (GEOM_POINT, GEOM_VECTOR...) - Standard_EXPORT int GetType(); - - //Sets the type of this GEOM_Object - Standard_EXPORT void SetType(int theType); - - //Modifications counter management - Standard_EXPORT int GetTic(); - Standard_EXPORT void SetTic(int theTic); - Standard_EXPORT void IncrementTic(); - - //Returns an ID of the OCAF document where this GEOM_Object is stored - Standard_EXPORT int GetDocID(); - //Returns a value (as TopoDS_Shape) of this GEOM_Object Standard_EXPORT TopoDS_Shape GetValue(); - //Sets a name of this GEOM_Object - Standard_EXPORT void SetName(const char* theName); - - //Returns a name of this GEOM_Object - Standard_EXPORT char* GetName(); - //Sets a color of this GEOM_Object - Standard_EXPORT void SetColor(const SALOMEDS::Color& theColor); + Standard_EXPORT void SetColor(const Color& theColor); //Returns a color of this GEOM_Object - Standard_EXPORT SALOMEDS::Color GetColor(); + Standard_EXPORT Color GetColor(); //Toggles an auto color mode on this GEOM_Object - Standard_EXPORT void SetAutoColor(CORBA::Boolean theAutoColor); + Standard_EXPORT void SetAutoColor(bool theAutoColor); //Returns a flag of auto color mode of this GEOM_Object - Standard_EXPORT CORBA::Boolean GetAutoColor(); - - //Sets an auxiliary data - Standard_EXPORT void SetAuxData(const char* theData); - - //Returns an auxiliary data - Standard_EXPORT TCollection_AsciiString GetAuxData(); + Standard_EXPORT bool GetAutoColor(); - //########################################################### - // Sub shape methods - //########################################################### + //Sets predefined point marker texture + Standard_EXPORT void SetMarkerStd(const Aspect_TypeOfMarker theType, double theSize); + + //Sets custom point marker texture + Standard_EXPORT void SetMarkerTexture(int theTextureId); - //Returns false if the object is a sub shape of another object - Standard_EXPORT bool IsMainShape(); + //Gets point marker type + Standard_EXPORT Aspect_TypeOfMarker GetMarkerType(); - //########################################################### - // CORBA related methods - //########################################################### + //Gets point marker scale factor / size + Standard_EXPORT double GetMarkerSize(); - //Sets an IOR of CORBA GEOM_Object_i which refers to this object - Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; } + //Gets custom marker texture ID + Standard_EXPORT int GetMarkerTexture(); - //Returns an IOR of CORBA GEOM_Object_i which refers to this object - Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; } + //Unsets point marker + Standard_EXPORT void UnsetMarker(); //########################################################### - //Functions methods + // Sub-shape methods //########################################################### - //Adds a function with a driver GUID = theGUID and a type theFunctionType - //to the function tree of this GEOM_Object - Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, int theFunctionType); - - //Returns a number of functions of this GEOM_Object - Standard_EXPORT int GetNbFunctions(); - - //Returns a function with given number theFunctionNumber - Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber); - - //Return the last function of this GEOM_Object - Standard_EXPORT Handle(GEOM_Function) GetLastFunction(); - - //Returns all dependencies of the object - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency(); - - //Returns the dependencies of the last function - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency(); - - //########################################################### - // Internal methods - //########################################################### + //Returns false if the object is a sub-shape of another object + Standard_EXPORT bool IsMainShape(); - //Returns a label which could be used to store some additional data - Standard_EXPORT TDF_Label GetFreeLabel(); + //Comfort method + Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) + GetLastFunctions( const std::list< Handle(GEOM_Object) >& theObjects ); - private: - Handle(TDataStd_TreeNode) _root; - TDF_Label _label; - TCollection_AsciiString _ior; +public: + DEFINE_STANDARD_RTTIEXT(GEOM_Object,GEOM_BaseObject) }; #endif