00001
00017 #ifndef INC_MI32_SPOVRGN_H
00018 #define INC_MI32_SPOVRGN_H
00019
00020 #ifndef INC_MI32_TRIANGULATOR_H
00021 #include <mi32/triangulator.h>
00022 #endif
00023
00024 #ifndef INC_RVC_RASTER_H
00025 #include <rvc/raster.h>
00026 #endif
00027
00028 #ifndef INC_RVC_NULLMASK_H
00029 #include <rvc/nullmask.h>
00030 #endif
00031
00032
00034 class SURFACE_REGION_PROP_CALC {
00035 public:
00036
00037 struct PROPERTIES {
00038 double m_ZLevel;
00039 double m_SurfaceArea;
00040 double m_VolumePositive;
00041 double m_VolumeNegative;
00042 double m_MinZ;
00043 double m_MaxZ;
00044 bool m_Full;
00045
00046 PROPERTIES (
00047 ) :
00048 m_ZLevel(0.0),
00049 m_SurfaceArea(0.0),
00050 m_VolumePositive(0.0),
00051 m_VolumeNegative(0.0),
00052 m_MinZ(DBL_MAX),
00053 m_MaxZ(-DBL_MAX),
00054 m_Full(true)
00055 { }
00056
00057 void Clear (
00058 ) {
00059 m_SurfaceArea = 0.0;
00060 m_VolumePositive = 0.0;
00061 m_VolumeNegative = 0.0;
00062 m_MinZ = DBL_MAX;
00063 m_MaxZ = -DBL_MAX;
00064 m_Full = true;
00065 }
00066 };
00067
00068 SURFACE_REGION_PROP_CALC ();
00069
00070 ~SURFACE_REGION_PROP_CALC ();
00071
00072 void Clear ();
00073
00074 bool Initialize (
00075 RVC::OBJITEM& objitem
00076 );
00077
00078 bool IsInitialized () { return m_Initialized; };
00079
00080 ERRVALUE Compute (
00081 const REGION2D& region,
00082 PROPERTIES& properties
00083 );
00084
00085 private:
00086 #ifndef GENERATING_DOXYGEN_OUTPUT
00087
00088 RVC::RASTER m_Surface;
00089 RVC::NULLMASK m_NullMask;
00090 RVC::RASTER::IMAGESCALE m_Scale;
00091 DPOINT2D m_NRScale;
00092 DRECT2D m_Extents;
00093
00094 TRIANGULATOR m_Triangulator;
00095 DOUBLE_ARRAY<DTRIANGLE2D> m_Triangles;
00096
00097 bool m_Initialized;
00098 PROPERTIES* m_Properties;
00099
00100 ERRVALUE ProcessRegion(const REGION2D& region);
00101 void ControlProcess (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3, const int mode);
00102
00103 void SplitY (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3, const int mode);
00104 void SplitEQY (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3, const int mode);
00105 void SplitNEQY (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3, const int mode);
00106 void SplitTtoB (const DPOINT2D& top, const DPOINT2D& b1, const DPOINT2D& b2, const int mode);
00107 void SplitBtoT (const DPOINT2D& bottom, const DPOINT2D& t1, const DPOINT2D& t2, const int mode);
00108
00109 void Process (const DPOINT2D& p1, const DPOINT2D& p2, const DPOINT2D& p3);
00110 bool CalculatePlane (const INT32 column, const INT32 line, const int status, DPOINT3D& plane);
00111 bool GetElevation(const INT32 column, const INT32 line, double& z);
00112
00113 void ComputeVolume (const DPOINT3D& p1, const DPOINT3D& p2, const DPOINT3D& p3, double& vp, double& vn);
00114 double ComputeTrianglePyramidVolume (const DPOINT3D& p1, const DPOINT3D& p2, const DPOINT3D& p3);
00115
00116 #endif // GENERATING_DOXYGEN_OUTPUT
00117 };
00118
00119 #endif // INC_MI32_SPOVRGN_H