Version: 9.16.0
XAO_Geometry.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19// Author : Nathalie Gore (OpenCascade)
20
21#ifndef __XAO_GEOMETRY_HXX__
22#define __XAO_GEOMETRY_HXX__
23
24#include <string>
25
26#include "XAO.hxx"
27#include "XAO_XaoUtils.hxx"
28#include "XAO_Exception.hxx"
30
31#ifdef WIN32
32#pragma warning(disable:4290) // Warning Exception ...
33#endif
34
35
36namespace XAO
37{
43 {
44 protected:
49 Geometry(const std::string& name);
50
51 public:
52
58 static Geometry* createGeometry(XAO::Format format) ;
59
66 static Geometry* createGeometry(XAO::Format format, const std::string& name);
67
69 virtual ~Geometry();
70
75 const std::string getName()
76 {
77 return m_name;
78 }
83 void setName(const std::string& name)
84 {
85 m_name = name;
86 }
87
92 virtual XAO::Format getFormat() = 0;
93
94 virtual const std::string getShapeString() = 0;
95 virtual void setShapeString(const std::string& shape) = 0;
96 virtual void writeShapeFile(const std::string& fileName) = 0;
97 virtual void readShapeFile(const std::string& fileName) = 0;
98
99 int countElements(XAO::Dimension dim) const ;
100 int countVertices() const { return m_vertices.getSize(); }
101 int countEdges() const { return m_edges.getSize(); }
102 int countFaces() const { return m_faces.getSize(); }
103 int countSolids() const { return m_solids.getSize(); }
104
105 void setCountVertices(int nb);
106 void setCountEdges(int nb);
107 void setCountFaces(int nb);
108 void setCountSolids(int nb);
109
110 const std::string getVertexName(int index) { return m_vertices.getName(index); }
111 const std::string getEdgeName(int index) { return m_edges.getName(index); }
112 const std::string getFaceName(int index) { return m_faces.getName(index); }
113 const std::string getSolidName(int index) { return m_solids.getName(index); }
114
115 void setVertexName(int index, const std::string& name) { m_vertices.setName(index, name); }
116 void setEdgeName(int index, const std::string& name) { m_edges.setName(index, name); }
117 void setFaceName(int index, const std::string& name) { m_faces.setName(index, name); }
118 void setSolidName(int index, const std::string& name) { m_solids.setName(index, name); }
119
120 bool hasVertexName(int index) { return m_vertices.hasName(index); }
121 bool hasEdgeName(int index) { return m_edges.hasName(index); }
122 bool hasFaceName(int index) { return m_faces.hasName(index); }
123 bool hasSolidName(int index) { return m_solids.hasName(index); }
124
125 const std::string getVertexReference(int index) { return m_vertices.getReference(index); }
126 const std::string getEdgeReference(int index) { return m_edges.getReference(index); }
127 const std::string getFaceReference(int index) { return m_faces.getReference(index); }
128 const std::string getSolidReference(int index) { return m_solids.getReference(index); }
129 const std::string getElementReference(XAO::Dimension dim, int index) ;
130
131 void setVertexReference(int index, const std::string& reference) ;
132 void setEdgeReference(int index, const std::string& reference) ;
133 void setFaceReference(int index, const std::string& reference) ;
134 void setSolidReference(int index, const std::string& reference) ;
135
136 void setVertex(int index, const std::string& name, const std::string& reference) ;
137 void setEdge(int index, const std::string& name, const std::string& reference) ;
138 void setFace(int index, const std::string& name, const std::string& reference) ;
139 void setSolid(int index, const std::string& name, const std::string& reference) ;
140
141 int getVertexIndexByReference(const std::string& reference) { return m_vertices.getIndexByReference(reference); }
142 int getEdgeIndexByReference(const std::string& reference) { return m_edges.getIndexByReference(reference); }
143 int getFaceIndexByReference(const std::string& reference) { return m_faces.getIndexByReference(reference); }
144 int getSolidIndexByReference(const std::string& reference) { return m_solids.getIndexByReference(reference); }
145 int getElementIndexByReference(XAO::Dimension dim, const std::string& reference) ;
146
149
154 bool isReadOnly() { return m_readOnly; }
155
159 void setReadOnly() { m_readOnly = true; }
160
161 protected:
162 void checkReadOnly() ;
163
164 protected:
165 std::string m_name;
171
172 };
173}
174
175#endif
#define XAO_EXPORT
Definition: XAO.hxx:31
Generic class to manipulate a list of topologic element.
Definition: XAO_GeometricElement.hxx:112
std::map< int, GeometricElement >::iterator iterator
Iterator on the element of the list.
Definition: XAO_GeometricElement.hxx:198
Base class for geometries.
Definition: XAO_Geometry.hxx:43
const std::string getFaceReference(int index)
Definition: XAO_Geometry.hxx:127
const std::string getName()
Gets the name of the geometry.
Definition: XAO_Geometry.hxx:75
virtual XAO::Format getFormat()=0
Gets the format of the geometry.
void setVertexName(int index, const std::string &name)
Definition: XAO_Geometry.hxx:115
const std::string getVertexReference(int index)
Definition: XAO_Geometry.hxx:125
virtual void setShapeString(const std::string &shape)=0
bool hasFaceName(int index)
Definition: XAO_Geometry.hxx:122
const std::string getSolidName(int index)
Definition: XAO_Geometry.hxx:113
int getFaceIndexByReference(const std::string &reference)
Definition: XAO_Geometry.hxx:143
GeometricElementList m_faces
Definition: XAO_Geometry.hxx:168
std::string m_name
Definition: XAO_Geometry.hxx:165
bool isReadOnly()
Verifies if the geometry is read only.
Definition: XAO_Geometry.hxx:154
int countSolids() const
Definition: XAO_Geometry.hxx:103
int countVertices() const
Definition: XAO_Geometry.hxx:100
const std::string getVertexName(int index)
Definition: XAO_Geometry.hxx:110
int countEdges() const
Definition: XAO_Geometry.hxx:101
bool m_readOnly
Definition: XAO_Geometry.hxx:170
GeometricElementList m_edges
Definition: XAO_Geometry.hxx:167
void setEdgeName(int index, const std::string &name)
Definition: XAO_Geometry.hxx:116
int getVertexIndexByReference(const std::string &reference)
Definition: XAO_Geometry.hxx:141
void setName(const std::string &name)
Sets the name of the geometry.
Definition: XAO_Geometry.hxx:83
GeometricElementList m_vertices
Definition: XAO_Geometry.hxx:166
const std::string getFaceName(int index)
Definition: XAO_Geometry.hxx:112
virtual const std::string getShapeString()=0
const std::string getSolidReference(int index)
Definition: XAO_Geometry.hxx:128
virtual void readShapeFile(const std::string &fileName)=0
const std::string getEdgeReference(int index)
Definition: XAO_Geometry.hxx:126
const std::string getEdgeName(int index)
Definition: XAO_Geometry.hxx:111
void setFaceName(int index, const std::string &name)
Definition: XAO_Geometry.hxx:117
int getEdgeIndexByReference(const std::string &reference)
Definition: XAO_Geometry.hxx:142
bool hasSolidName(int index)
Definition: XAO_Geometry.hxx:123
bool hasVertexName(int index)
Definition: XAO_Geometry.hxx:120
void setReadOnly()
Sets the geometry read only.
Definition: XAO_Geometry.hxx:159
void setSolidName(int index, const std::string &name)
Definition: XAO_Geometry.hxx:118
bool hasEdgeName(int index)
Definition: XAO_Geometry.hxx:121
int countFaces() const
Definition: XAO_Geometry.hxx:102
int getSolidIndexByReference(const std::string &reference)
Definition: XAO_Geometry.hxx:144
virtual void writeShapeFile(const std::string &fileName)=0
GeometricElementList m_solids
Definition: XAO_Geometry.hxx:169
Definition: BrepGeometryTest.hxx:26
Dimension
Definition: XAO_XaoUtils.hxx:50
Format
Definition: XAO_XaoUtils.hxx:41