Overture  Version 25
IgesReader.h
Go to the documentation of this file.
1 #ifndef IGES_READER_H
2 #define IGES_READER_H
3 
4 #include "Mapping.h"
5 
6 #include <time.h>
7 #include <ctype.h>
8 #include <unistd.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 
13 #define RECBUF 81 /* Buffer size for IGS record */
14 #define KEYPOS 72 /* Key word for extracting IGS file */
15 
17 {
18  public:
19 
21  {
25  conicArc=104,
27  plane=108,
28  line=110,
31  point=116,
35  direction=123,
37  flash=125,
42  node=134,
46  boundary=141,
52  block=150,
56  sphere=158,
57  torus=160,
60  ellipsoid=168,
73  flagNote=208,
77  leader=214, //(arrow)
90  unitsData=316,
94  drawing=404,
95  property=406,
97  view=410,
105  vertex=502,
106  edge=504,
107  loop=508,
108  face=510,
112  };
113 
114  double getTolerance() const {return tolerance;} //
115  double getScale() const {return scale;} //
116 
117  double scale, tolerance;
118  int units;
119  FILE *fp;
120 
122  {
130  };
131 
132  inline int entity( int item ) const { return entityInfo(entityPosition,item); }
133  inline int sequenceNumber( int item ) const { return entityInfo(sequenceNumberPosition,item); }
134  inline int parameterData( int item ) const { return entityInfo(parameterDataPosition,item); }
135  inline int matrix( int item ) const { return entityInfo(matrixPosition,item); }
136  inline int isVisible( int item ) const { return (entityInfo(visiblePosition,item) % 2) ; }
137  inline int isIndependent( int item ) const { return (entityInfo(dependentPosition,item)/2) % 2 ; }
138  inline int formData( int item ) const { return entityInfo(formPosition,item); }
139 
140  long parameterPosition; // position in file where parameter data starts
141 
142  IgesReader();
143  ~IgesReader();
144 
145  int readIgesFile(const char *fileName );
146 
147  // read parameter data for a given item number
148  int readData(const int & i, RealArray & data, const int & numberToRead);
149  #ifdef USE_PPP
150  int readData(const int & i, realArray & data, const int & numberToRead);
151  #endif
152 
153  // read parameter data given a pointer to the location
154  int readParameterData(const int & parameterDataPointer, RealArray & data, const int & numberToRead);
155  #ifdef USE_PPP
156  int readParameterData(const int & parameterDataPointer, realArray & data, const int & numberToRead);
157  #endif
158 
159  int numberOfEntities();
160 
161  int processFile();
162 
163  int getData(RealArray & data, int max_data);
164 
165  aString entityName(const int & entity );
166 
167  int sequenceToItem( const int & sequence ); // return the entry in the entityInfo array for a given sequence number
168 
169 
170  protected:
171 
172  long fieldNumber(const char *buff, int field);
173 
174  int getSequenceNumber(const char *buff); // return seq number from Parameter line
175 
176 
177  private:
178  enum
179  {
180  recordBufferSize=81, // Buffer size for Iges record
181  keyWordPosition=72 // Iges key word position
182  };
183 
184 
185  IntegerArray entityInfo; // holds info about objects in file (info found in the directory)
186 
187  int entityCount;
188 
189  double bound;
190  char fieldDelimiter, recordDelimiter;
191  int process; /* default process specified */
192  long savep,entype,form,trans_mtr,Color,parameter,seqnum,
193  formMatrix,status,visible,subordinate,
194  entityUse,hierarchy,level;
195  int infoLevel;
196 
197 };
198 
199 #endif