00001
00031 #ifndef INC_GRE_WIREFRAME_H
00032 #define INC_GRE_WIREFRAME_H
00033
00034 #ifndef INC_GRE_BASE_H
00035 #include <gre/base.h>
00036 #endif
00037
00038 #ifndef INC_MI32_POLYLINE_H
00039 #include <mi32/polyline.h>
00040 #endif
00041
00042 #ifndef INC_MI32_COLOR_H
00043 #include <mi32/color.h>
00044 #endif
00045
00046
00047 #ifndef GENERATING_DOXYGEN_OUTPUT
00048 namespace RVC {
00049 class DBTABLE;
00050 class OBJECTOBSERVER;
00051 }
00052 #endif // GENERATING_DOXYGEN_OUTPUT
00053
00054
00055 namespace GRE {
00056
00060 class WIREFRAME {
00061 public:
00062
00063 WIREFRAME ();
00064
00065 ~WIREFRAME ();
00066
00068 ERRVALUE AddExtrudedLine (
00069 const POLYLINE& PolyLine,
00070 const DOUBLE_RANGE& ZRange
00071 );
00072
00074 ERRVALUE AddExtrudedPoint (
00075 const DPOINT3D& Point,
00076 const DOUBLE_RANGE& ZRange
00077 );
00078
00080 ERRVALUE AddLine (
00081 const POLYLINE& PolyLine
00082 );
00083
00085 ERRVALUE AddPoint (
00086 const DPOINT3D& point
00087 );
00088
00090 ERRVALUE AddPoints (
00091 const DPOINT3D* points,
00092 INT32 NumPoints
00093 );
00094
00097 ERRVALUE AttachTableExtrudedLines (
00098 const RVC::DBTABLE& table
00099 );
00100
00103 ERRVALUE AttachTableExtrudedPoints (
00104 const RVC::DBTABLE& table
00105 );
00106
00108 void ClearAll ();
00109
00110 void ClearExtrudedLines (
00111 );
00112
00113 void ClearExtrudedPoints (
00114 );
00115
00117 void ClearGrid (
00118 ) { m_grid.Clear(); }
00119
00121 void ClearLines ();
00122
00124 void ClearNetwork (
00125 ) { }
00126
00128 ERRVALUE CreateGrid (
00129 INT32 NumRows,
00130 INT32 NumColumns,
00131 const DPOINT2D& ObjectSpacing,
00132 const DPOINT2D& ObjectOrigin
00133 ) { return (m_grid.Create(NumRows,NumColumns,ObjectSpacing,ObjectOrigin)); }
00134
00136 ERRVALUE Draw (
00137 LAYERDC& layerdc
00138 );
00139
00140 bool HasExtrudedLines (
00141 ) const { return (!m_ExtrudedLines.IsEmpty()); }
00142
00143 bool HasExtrudedPoints (
00144 ) const { return (!m_ExtrudedPoints.IsEmpty()); }
00145
00146 bool HasGrid (
00147 ) const { return (m_grid.IsCreated()); }
00148
00149 bool HasLines (
00150 ) const { return (!m_lines.IsEmpty()); }
00151
00152 bool HasPoints (
00153 ) const { return (!m_points.IsEmpty()); }
00154
00157 void SetGridValues (
00158 INT32 row,
00159 INT32 column,
00160 const double *values,
00161 const UINT8 *mask,
00162 INT32 numcolumns = 1
00163 ) { m_grid.SetValues(row,column,values,mask,numcolumns); }
00164
00165 void SetExtrudedLineColors (
00166 const COLOR& ColorBelow,
00167 const COLOR& ColorAbove
00168 ) { m_ExtrudedLineColorBelow = ColorBelow; m_ExtrudedLineColorAbove = ColorAbove; }
00169
00170 void SetExtrudedPointColors (
00171 const COLOR& ColorBelow,
00172 const COLOR& ColorAbove
00173 ) { m_ExtrudedPointColorBelow = ColorBelow; m_ExtrudedPointColorAbove = ColorAbove; }
00174
00175 private:
00176 #ifndef GENERATING_DOXYGEN_OUTPUT
00177
00178
00179 class GRID {
00180 public:
00181 GRID ();
00182 ~GRID ();
00183 void Clear ();
00184 ERRVALUE Create (
00185 INT32 NumRows,
00186 INT32 NumColumns,
00187 const DPOINT2D& ObjectSpacing,
00188 const DPOINT2D& ObjectOrigin
00189 );
00190 ERRVALUE Draw (LAYERDC& layerdc) const;
00191 bool IsCreated (
00192 ) const { return (!m_values.IsEmpty()); }
00193 void SetValues (
00194 INT32 row,
00195 INT32 column,
00196 const double *values,
00197 const UINT8 *mask,
00198 INT32 numcolumns = 1
00199 );
00200
00201 private:
00202 DOUBLE_ARRAY<double> m_values;
00203 DPOINT2D m_ObjectSpacing;
00204 DPOINT2D m_ObjectOrigin;
00205 INT32 m_NumRows;
00206 INT32 m_NumColumns;
00207 };
00208
00209 class NETWORK {
00210 public:
00211 NETWORK ();
00212 ~NETWORK ();
00213 void Clear () { }
00214 ERRVALUE Draw (LAYERDC&) const { return (0); }
00215
00216 private:
00217 struct EDGE {
00218 INT32 m_NodeFrom;
00219 INT32 m_NodeTo;
00220 };
00221 DOUBLE_ARRAY<DPOINT3D> m_Nodes;
00222 SIMPLE_ARRAY<EDGE> m_Edges;
00223 };
00224
00225 class EXTRUDEDLINE {
00226 public:
00227 EXTRUDEDLINE (
00228 const POLYLINE& PolyLine,
00229 const DOUBLE_RANGE& ZRange
00230 );
00231 ~EXTRUDEDLINE ();
00232 const POLYLINE& GetPolyLine (
00233 ) const { return (m_PolyLine); }
00234 const DOUBLE_RANGE& GetZRange (
00235 ) const { return (m_ZRange); }
00236 private:
00237 POLYLINE m_PolyLine;
00238 DOUBLE_RANGE m_ZRange;
00239 };
00240 typedef MILIST<EXTRUDEDLINE> EXTRUDEDLINELIST;
00241
00242 class EXTRUDEDPOINT {
00243 public:
00244 EXTRUDEDPOINT (
00245 const DPOINT3D& Point,
00246 const DOUBLE_RANGE& ZRange
00247 );
00248 ~EXTRUDEDPOINT ();
00249 const DPOINT3D& GetPoint (
00250 ) const { return (m_Point); }
00251 const DOUBLE_RANGE& GetZRange (
00252 ) const { return (m_ZRange); }
00253 private:
00254 DPOINT3D m_Point;
00255 DOUBLE_RANGE m_ZRange;
00256 };
00257 typedef MILIST<EXTRUDEDPOINT> EXTRUDEDPOINTLIST;
00258
00259 GRID m_grid;
00260 POLYLINELIST m_lines;
00261 DOUBLE_ARRAY<DPOINT3D> m_points;
00262 EXTRUDEDLINELIST m_ExtrudedLines;
00263 EXTRUDEDPOINTLIST m_ExtrudedPoints;
00264 RVC::DBTABLE *m_pObjTableExtrudedLines;
00265 RVC::DBTABLE *m_pObjTableExtrudedPoints;
00266 RVC::OBJECTOBSERVER *m_pObsTableExtrudedLines;
00267 RVC::OBJECTOBSERVER *m_pObsTableExtrudedPoints;
00268 COLOR m_ExtrudedLineColorBelow;
00269 COLOR m_ExtrudedLineColorAbove;
00270 COLOR m_ExtrudedPointColorBelow;
00271 COLOR m_ExtrudedPointColorAbove;
00272
00273 ERRVALUE DrawExtrudedLines (LAYERDC& layerdc) const;
00274 ERRVALUE DrawExtrudedPoints (LAYERDC& layerdc) const;
00275 ERRVALUE DrawLines (LAYERDC& layerdc) const;
00276 ERRVALUE DrawPoints (LAYERDC& layerdc) const;
00277
00278 void OnChgTableExtrudedLines ();
00279 void OnChgTableExtrudedPoints ();
00280 #endif // GENERATING_DOXYGEN_OUTPUT
00281 };
00282
00283 }
00284
00285 #endif // INC_GRE_WIREFRAME_H