82 lines
2.1 KiB
C++
82 lines
2.1 KiB
C++
#ifndef _MESH_HPP_
|
|
#define _MESH_HPP_
|
|
#include <stdio.h>
|
|
#include <mdiwin/string.hpp>
|
|
#include <mdiwin/segment.hpp>
|
|
#include <mdiwin/window.hpp>
|
|
#include <mdiwin/polypnt.hpp>
|
|
#include <mdiwin/vector.hpp>
|
|
|
|
class GridMesh : public Vector<Segment>, public Window
|
|
{
|
|
public:
|
|
enum GridShow{Show,NoShow};
|
|
GridMesh(HWND hParent,int width,int height,GridShow visibility=Show);
|
|
~GridMesh(void);
|
|
void newMesh(WORD gridLines=GridLines);
|
|
WORD saveMesh(String &pathFileName);
|
|
WORD loadMesh(String &pathFileName);
|
|
WORD retrieveMesh(Vector<Point> &sourcePoints,Vector<Point> &destPoints);
|
|
WORD rowCols(void)const;
|
|
WORD gridLines(void)const;
|
|
WORD upgradeStatus(WORD retCode);
|
|
WORD isVisible(void)const;
|
|
void showWindow(int visible=TRUE);
|
|
void suspendMesh(WORD suspend);
|
|
private:
|
|
typedef LONG Index;
|
|
enum Status{InActive,Active};
|
|
enum {IntersectionSegments=4};
|
|
enum {GridLines=8,MaxGridLines=16};
|
|
void registerClass(void);
|
|
long WndProc(UINT message,WPARAM wParam,LPARAM lParam);
|
|
void paint(void);
|
|
void mouseUp(int x,int y);
|
|
void mouseDown(int x,int y);
|
|
void mouseMove(int x,int y);
|
|
DWORD minDistance(const Segment &someSegment,const Point &mousePoint);
|
|
WORD closestIntersection(Block<Segment> &filterSegment,Point &mousePoint);
|
|
WORD orderIntersection(Block<Segment> &intersection);
|
|
WORD isInBlock(Block<Segment> &source,Segment &someSegment);
|
|
void createMesh(WORD gridLines,Vector<Segment> &someSegmentVector);
|
|
WORD retrieveMesh(Vector<Point> &meshPoints,Vector<Segment> &meshSegments)const;
|
|
|
|
static char szClassName[];
|
|
static char szMenuName[];
|
|
Block<Segment> mCurrentIntersection;
|
|
int mGridLines;
|
|
Status mStatus;
|
|
String mVersionInfo;
|
|
WORD mIsSuspended;
|
|
COLORREF mStandardColor;
|
|
HPEN mhDrawingPen;
|
|
HWND mhParent;
|
|
HINSTANCE mhInstance;
|
|
};
|
|
|
|
inline
|
|
WORD GridMesh::isVisible(void)const
|
|
{
|
|
return ::IsWindowVisible(GetHandle());
|
|
}
|
|
|
|
inline
|
|
WORD GridMesh::gridLines(void)const
|
|
{
|
|
return mGridLines;
|
|
}
|
|
|
|
inline
|
|
WORD GridMesh::rowCols(void)const
|
|
{
|
|
return mGridLines+2;
|
|
}
|
|
|
|
inline
|
|
void GridMesh::suspendMesh(WORD suspend)
|
|
{
|
|
if(suspend)mIsSuspended=TRUE;
|
|
else mIsSuspended=FALSE;
|
|
}
|
|
#endif
|