Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:22

0001 // Created on: 1999-09-28
0002 // Created by: Denis PASCAL
0003 // Copyright (c) 1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TNaming_Selector_HeaderFile
0018 #define _TNaming_Selector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TDF_Label.hxx>
0025 #include <TDF_LabelMap.hxx>
0026 #include <TDF_AttributeMap.hxx>
0027 class TopoDS_Shape;
0028 class TNaming_NamedShape;
0029 
0030 
0031 //! This class provides a single API for selection of shapes.
0032 //! This involves both identification and selection of
0033 //! shapes in the data framework.
0034 //! If the selected shape is modified, this selector will
0035 //! solve its identifications.
0036 //! This class is the user interface for topological
0037 //! naming resources.
0038 //! * The   <IsIdentified> method returns  (if exists)
0039 //! the NamedShape which  contains a given shape. The
0040 //! definition of  an  identified shape is :   a Shape
0041 //! handled by a NamedShape  (this shape  is the only
0042 //! one stored) , which  has the TNaming_PRImITIVE evolution
0043 //!
0044 //! *  The   <Select> method  returns   ALWAYS a  new
0045 //! NamedShape at the given  label, which contains the
0046 //! argument  selected  shape.    When  calling  this
0047 //! method, the sub-hierarchy of <label> is first cleared,
0048 //! then a TNaming_NamedShape   is ALWAYS created  at
0049 //! this <label>, with the TNaming_SELECTED evolution.
0050 //! The <Naming attribute> is associated to the selected
0051 //! shape which store the arguments of the selection .
0052 //! If the given selected shape was already identified
0053 //! (method IsIdentified)   , this   Naming attribute
0054 //! contains  the reference (Identity  code)  to the
0055 //! argument shape.
0056 //!
0057 //! * The <Solve> method  update the current value of
0058 //! the NamedShape, according to the <Naming> attribute.
0059 //! A boolean status  is    returned to say  if  the
0060 //! algorithm succeed   or not.  To read   the current
0061 //! value    of the selected    Named  Shape  use the
0062 //! TNaming_Tool::GetShape    method,    as  for  any
0063 //! NamedShape attribute.
0064 class TNaming_Selector 
0065 {
0066 public:
0067 
0068   DEFINE_STANDARD_ALLOC
0069 
0070   
0071   //! To know if a shape is already identified (not selected)
0072   //! =======================================================
0073   //!
0074   //! The label access defines the point of access to the data framework.
0075   //! selection is the shape for which we want to know
0076   //! whether it is identified or not.
0077   //! If true, NS is returned as the identity of selection.
0078   //! If Geometry is true, NS will be the named shape
0079   //! containing the first appearance of selection and
0080   //! not any other shape. In other words, selection
0081   //! must be the only shape stored in NS.
0082   Standard_EXPORT static Standard_Boolean IsIdentified (const TDF_Label& access, const TopoDS_Shape& selection, Handle(TNaming_NamedShape)& NS, const Standard_Boolean Geometry = Standard_False);
0083   
0084   //! Create a selector on this label
0085   //! to select a shape.
0086   //! ==================
0087   Standard_EXPORT TNaming_Selector(const TDF_Label& aLabel);
0088   
0089 
0090   //! Creates a topological naming on the label
0091   //! aLabel given as an argument at construction time.
0092   //! If successful, the shape Selection - found in the
0093   //! shape Context - is now identified in the named
0094   //! shape returned in NamedShape.
0095   //! If Geometry is true, NamedShape contains the
0096   //! first appearance of Selection.
0097   //! This syntax is more robust than the previous
0098   //! syntax for this method.
0099   Standard_EXPORT Standard_Boolean Select (const TopoDS_Shape& Selection, const TopoDS_Shape& Context, const Standard_Boolean Geometry = Standard_False, const Standard_Boolean KeepOrientatation = Standard_False) const;
0100   
0101 
0102   //! Creates a topological naming on the label
0103   //! aLabel given as an argument at construction time.
0104   //! If successful, the shape Selection is now
0105   //! identified in the named shape returned in NamedShape.
0106   //! If Geometry is true, NamedShape contains the
0107   //! first appearance of Selection.
0108   Standard_EXPORT Standard_Boolean Select (const TopoDS_Shape& Selection, const Standard_Boolean Geometry = Standard_False, const Standard_Boolean KeepOrientatation = Standard_False) const;
0109   
0110 
0111   //! Updates the topological naming on the label
0112   //! aLabel given as an argument at construction time.
0113   //! The underlying shape returned in the method
0114   //! NamedShape is updated.
0115   //! To read this shape, use the method TNaming_Tool::GetShape
0116   Standard_EXPORT Standard_Boolean Solve (TDF_LabelMap& Valid) const;
0117   
0118   //! Returns the attribute list args.
0119   //! This list contains the named shape on which the topological naming was built.
0120   Standard_EXPORT void Arguments (TDF_AttributeMap& args) const;
0121   
0122   //! Returns the NamedShape build or under construction,
0123   //! which contains the topological naming..
0124   Standard_EXPORT Handle(TNaming_NamedShape) NamedShape() const;
0125 
0126 
0127 
0128 
0129 protected:
0130 
0131 
0132 
0133 
0134 
0135 private:
0136 
0137 
0138 
0139   TDF_Label myLabel;
0140 
0141 
0142 };
0143 
0144 
0145 
0146 
0147 
0148 
0149 
0150 #endif // _TNaming_Selector_HeaderFile