2013-04-01 18:25:01 +06:00
|
|
|
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
2008-03-07 12:45:34 +05:00
|
|
|
//
|
2012-08-09 13:58:02 +06:00
|
|
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
2008-03-07 12:45:34 +05:00
|
|
|
//
|
2012-08-09 13:58:02 +06:00
|
|
|
// 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.
|
2005-12-05 21:23:52 +05:00
|
|
|
//
|
2012-08-09 13:58:02 +06:00
|
|
|
// 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.
|
2005-12-05 21:23:52 +05:00
|
|
|
//
|
2012-08-09 13:58:02 +06:00
|
|
|
// 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
|
2009-02-13 17:16:39 +05:00
|
|
|
//
|
2012-08-09 13:58:02 +06:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2005-12-05 21:23:52 +05:00
|
|
|
//
|
2012-08-09 13:58:02 +06:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
#ifndef _GEOM_Object_HeaderFile
|
|
|
|
#define _GEOM_Object_HeaderFile
|
|
|
|
|
|
|
|
#ifndef _Standard_TypeMismatch_HeaderFile
|
|
|
|
#include <Standard_TypeMismatch.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _Standard_HeaderFile
|
|
|
|
#include <Standard.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _Standard_Macro_HeaderFile
|
|
|
|
#include <Standard_Macro.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _Standard_HeaderFile
|
|
|
|
#include <Standard.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _Handle_MMgt_TShared_HeaderFile
|
|
|
|
#include <Handle_MMgt_TShared.hxx>
|
2008-03-07 12:45:34 +05:00
|
|
|
#endif
|
2004-12-01 15:39:14 +05:00
|
|
|
#ifndef _MMgt_TShared_HeaderFile
|
|
|
|
#include <MMgt_TShared.hxx>
|
2008-03-07 12:45:34 +05:00
|
|
|
#endif
|
2004-12-01 15:39:14 +05:00
|
|
|
#ifndef _Standard_GUID_HeaderFile
|
|
|
|
#include <Standard_GUID.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TopoDS_Shape_HeaderFile
|
|
|
|
#include <TopoDS_Shape.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TDF_Label_HeaderFile
|
|
|
|
#include <TDF_Label.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TColStd_HSequenceOfTransient_HeaderFile
|
|
|
|
#include <TColStd_HSequenceOfTransient.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _TCollection_AsciiString_HeaderFile
|
|
|
|
#include <TCollection_AsciiString.hxx>
|
|
|
|
#endif
|
2012-08-09 13:58:02 +06:00
|
|
|
#ifndef _Aspect_TypeOfMarker_HeaderFile
|
|
|
|
#include <Aspect_TypeOfMarker.hxx>
|
|
|
|
#endif
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
class Handle_TColStd_HSequenceOfTransient;
|
|
|
|
class Standard_Transient;
|
|
|
|
class Handle_Standard_Type;
|
|
|
|
class Handle(MMgt_TShared);
|
|
|
|
class GEOM_Object;
|
2013-06-17 18:19:23 +06:00
|
|
|
class Handle(TFunction_Driver);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
|
|
|
|
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Object);
|
|
|
|
|
|
|
|
class Handle(GEOM_Object) : public Handle(MMgt_TShared) {
|
|
|
|
public:
|
2008-03-07 12:45:34 +05:00
|
|
|
inline void* operator new(size_t,void* anAddress)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
return anAddress;
|
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
inline void* operator new(size_t size)
|
|
|
|
{
|
|
|
|
return Standard::Allocate(size);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
inline void operator delete(void *anAddress)
|
|
|
|
{
|
|
|
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object)():Handle(MMgt_TShared)() {}
|
|
|
|
Handle(GEOM_Object)(const Handle(GEOM_Object)& aHandle) : Handle(MMgt_TShared)(aHandle)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object)(const GEOM_Object* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
GEOM_Object* operator->()
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
return (GEOM_Object *)ControlAccess();
|
|
|
|
}
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
GEOM_Object* operator->() const
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
return (GEOM_Object *)ControlAccess();
|
|
|
|
}
|
|
|
|
|
|
|
|
Standard_EXPORT ~Handle(GEOM_Object)() {};
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
Standard_EXPORT static const Handle(GEOM_Object) DownCast(const Handle(Standard_Transient)& AnObject);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#include <Standard_GUID.hxx>
|
|
|
|
#include <TDataStd_TreeNode.hxx>
|
|
|
|
#include "GEOM_Function.hxx"
|
|
|
|
#include "GEOM_Engine.hxx"
|
|
|
|
|
|
|
|
class GEOM_Object : public MMgt_TShared
|
|
|
|
{
|
2008-03-07 12:45:34 +05:00
|
|
|
friend class GEOM_Engine;
|
2012-08-09 13:58:02 +06:00
|
|
|
|
|
|
|
public:
|
|
|
|
struct Color {
|
|
|
|
//! Red component of the color
|
|
|
|
double R;
|
|
|
|
//! Green component of the color
|
|
|
|
double G;
|
|
|
|
//! Blue component of the color
|
|
|
|
double B;
|
|
|
|
};
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
public:
|
2008-03-07 12:45:34 +05:00
|
|
|
inline void* operator new(size_t,void* anAddress)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
return anAddress;
|
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
inline void* operator new(size_t size)
|
|
|
|
{
|
|
|
|
return Standard::Allocate(size);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
inline void operator delete(void *anAddress)
|
|
|
|
{
|
|
|
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
// Type management
|
|
|
|
//
|
|
|
|
Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_();
|
|
|
|
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Object) ; }
|
2008-03-07 12:45:34 +05:00
|
|
|
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
|
|
|
|
{ return (STANDARD_TYPE(GEOM_Object) == AType || MMgt_TShared::IsKind(AType)); }
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
private:
|
2008-03-07 12:45:34 +05:00
|
|
|
GEOM_Object(TDF_Label& theLabel);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
public:
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType);
|
2012-08-09 13:58:02 +06:00
|
|
|
Standard_EXPORT ~GEOM_Object();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Finds a GEOM_Object on the label theLabel
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Finds a GEOM_Object by a reference, stored on the label theLabel
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Returns a GEOM_Object common GUID
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT static const Standard_GUID& GetObjectID();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2012-08-09 13:58:02 +06:00
|
|
|
//Returns a GUID associated with a sub-shape object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT static const Standard_GUID& GetSubShapeID();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//###########################################################
|
2008-03-07 12:45:34 +05:00
|
|
|
//Access to properties
|
2004-12-01 15:39:14 +05:00
|
|
|
//###########################################################
|
|
|
|
|
|
|
|
//Returns a TreeNode that presents a root of a function tree for this GEOM_Object
|
2008-03-07 12:45:34 +05:00
|
|
|
Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; }
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Returns a label of this GEOM_Object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT TDF_Label GetEntry() { return _label; }
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Returns a type of this GEOM_Object (GEOM_POINT, GEOM_VECTOR...)
|
2008-03-07 12:45:34 +05:00
|
|
|
Standard_EXPORT int GetType();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Sets the type of this GEOM_Object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT void SetType(int theType);
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//Modifications counter management
|
|
|
|
Standard_EXPORT int GetTic();
|
|
|
|
Standard_EXPORT void SetTic(int theTic);
|
|
|
|
Standard_EXPORT void IncrementTic();
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Returns an ID of the OCAF document where this GEOM_Object is stored
|
2008-03-07 12:45:34 +05:00
|
|
|
Standard_EXPORT int GetDocID();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Returns a value (as TopoDS_Shape) of this GEOM_Object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT TopoDS_Shape GetValue();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Sets a name of this GEOM_Object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT void SetName(const char* theName);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Returns a name of this GEOM_Object
|
2013-06-19 20:23:50 +06:00
|
|
|
Standard_EXPORT TCollection_AsciiString GetName();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Sets a color of this GEOM_Object
|
2012-08-09 13:58:02 +06:00
|
|
|
Standard_EXPORT void SetColor(const Color& theColor);
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//Returns a color of this GEOM_Object
|
2012-08-09 13:58:02 +06:00
|
|
|
Standard_EXPORT Color GetColor();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//Toggles an auto color mode on this GEOM_Object
|
2012-08-09 13:58:02 +06:00
|
|
|
Standard_EXPORT void SetAutoColor(bool theAutoColor);
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//Returns a flag of auto color mode of this GEOM_Object
|
2012-08-09 13:58:02 +06:00
|
|
|
Standard_EXPORT bool GetAutoColor();
|
|
|
|
|
|
|
|
//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);
|
|
|
|
|
|
|
|
//Gets point marker type
|
|
|
|
Standard_EXPORT Aspect_TypeOfMarker GetMarkerType();
|
|
|
|
|
|
|
|
//Gets point marker scale factor / size
|
|
|
|
Standard_EXPORT double GetMarkerSize();
|
|
|
|
|
|
|
|
//Gets custom marker texture ID
|
|
|
|
Standard_EXPORT int GetMarkerTexture();
|
|
|
|
|
|
|
|
//Unsets point marker
|
|
|
|
Standard_EXPORT void UnsetMarker();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Sets an auxiliary data
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT void SetAuxData(const char* theData);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Returns an auxiliary data
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT TCollection_AsciiString GetAuxData();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
//Set a notebook variables used for object creation
|
|
|
|
Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters);
|
|
|
|
|
|
|
|
//Get a notebook variables used for object creation
|
|
|
|
Standard_EXPORT TCollection_AsciiString GetParameters() const;
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//###########################################################
|
2012-08-09 13:58:02 +06:00
|
|
|
// Sub-shape methods
|
2004-12-01 15:39:14 +05:00
|
|
|
//###########################################################
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2012-08-09 13:58:02 +06:00
|
|
|
//Returns false if the object is a sub-shape of another object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT bool IsMainShape();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//###########################################################
|
|
|
|
// CORBA related methods
|
|
|
|
//###########################################################
|
|
|
|
|
|
|
|
//Sets an IOR of CORBA GEOM_Object_i which refers to this object
|
|
|
|
Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Returns an IOR of CORBA GEOM_Object_i which refers to this object
|
|
|
|
Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//###########################################################
|
|
|
|
//Functions methods
|
|
|
|
//###########################################################
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Adds a function with a driver GUID = theGUID and a type theFunctionType
|
|
|
|
//to the function tree of this GEOM_Object
|
2012-08-09 13:58:02 +06:00
|
|
|
Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID,
|
|
|
|
int theFunctionType,
|
|
|
|
bool allowSubShape=false);
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Returns a number of functions of this GEOM_Object
|
2008-03-07 12:45:34 +05:00
|
|
|
Standard_EXPORT int GetNbFunctions();
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Returns a function with given number theFunctionNumber
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber);
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Return the last function of this GEOM_Object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT Handle(GEOM_Function) GetLastFunction();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Returns all dependencies of the object
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Returns the dependencies of the last function
|
2005-08-11 10:04:55 +06:00
|
|
|
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2013-06-17 18:19:23 +06:00
|
|
|
//Returns a driver creator of this object
|
|
|
|
Standard_EXPORT Handle(TFunction_Driver) GetCreationDriver();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//###########################################################
|
|
|
|
// Internal methods
|
|
|
|
//###########################################################
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Returns a label which could be used to store some additional data
|
|
|
|
Standard_EXPORT TDF_Label GetFreeLabel();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
private:
|
|
|
|
Handle(TDataStd_TreeNode) _root;
|
2008-03-07 12:45:34 +05:00
|
|
|
TDF_Label _label;
|
|
|
|
TCollection_AsciiString _ior;
|
2009-02-13 17:16:39 +05:00
|
|
|
TCollection_AsciiString _parameters;
|
2012-08-09 13:58:02 +06:00
|
|
|
int _docID;
|
|
|
|
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|