This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

44
mesh/MESH.DSW Normal file
View File

@@ -0,0 +1,44 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "common"=..\COMMON\common.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "mesh"=.\Mesh.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

430
mesh/MESH.MAK Normal file
View File

@@ -0,0 +1,430 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=mesh - Win32 Debug
!MESSAGE No configuration specified. Defaulting to mesh - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "mesh - Win32 Release" && "$(CFG)" != "mesh - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Mesh.mak" CFG="mesh - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mesh - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "mesh - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "mesh - Win32 Debug"
MTL=mktyplib.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mesh - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\Mesh.exe"
CLEAN :
-@erase "$(INTDIR)\Main.obj"
-@erase "$(INTDIR)\Mainwnd.obj"
-@erase "$(INTDIR)\Mesh.obj"
-@erase "$(INTDIR)\Polypnt.obj"
-@erase "$(INTDIR)\Segment.obj"
-@erase "$(OUTDIR)\Mesh.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)/Mesh.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=.\.
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Mesh.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)/Mesh.pdb" /machine:I386 /out:"$(OUTDIR)/Mesh.exe"
LINK32_OBJS= \
"$(INTDIR)\Main.obj" \
"$(INTDIR)\Mainwnd.obj" \
"$(INTDIR)\Mesh.obj" \
"$(INTDIR)\Polypnt.obj" \
"$(INTDIR)\Segment.obj" \
"..\exe\mscommon.lib"
"$(OUTDIR)\Mesh.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "msvcobj"
# PROP Intermediate_Dir "msvcobj"
# PROP Target_Dir ""
OUTDIR=.\msvcobj
INTDIR=.\msvcobj
ALL : "$(OUTDIR)\Mesh.exe"
CLEAN :
-@erase "$(INTDIR)\Main.obj"
-@erase "$(INTDIR)\Mainwnd.obj"
-@erase "$(INTDIR)\Mesh.obj"
-@erase "$(INTDIR)\Polypnt.obj"
-@erase "$(INTDIR)\Segment.obj"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(OUTDIR)\Mesh.exe"
-@erase "$(OUTDIR)\Mesh.ilk"
-@erase "$(OUTDIR)\Mesh.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Zp1 /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /c
CPP_PROJ=/nologo /Zp1 /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/D "STRICT" /D "__FLAT__" /Fp"$(INTDIR)/Mesh.pch" /YX /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
CPP_OBJS=.\msvcobj/
CPP_SBRS=.\.
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/Mesh.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/Mesh.pdb" /debug /machine:I386 /out:"$(OUTDIR)/Mesh.exe"
LINK32_OBJS= \
"$(INTDIR)\Main.obj" \
"$(INTDIR)\Mainwnd.obj" \
"$(INTDIR)\Mesh.obj" \
"$(INTDIR)\Polypnt.obj" \
"$(INTDIR)\Segment.obj" \
"..\exe\mscommon.lib"
"$(OUTDIR)\Mesh.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "mesh - Win32 Release"
# Name "mesh - Win32 Debug"
!IF "$(CFG)" == "mesh - Win32 Release"
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\Segment.cpp
DEP_CPP_SEGME=\
{$(INCLUDE)}"\.\Segment.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Segment.obj" : $(SOURCE) $(DEP_CPP_SEGME) "$(INTDIR)"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Mainwnd.cpp
!IF "$(CFG)" == "mesh - Win32 Release"
DEP_CPP_MAINW=\
{$(INCLUDE)}"\.\Mainwnd.hpp"\
{$(INCLUDE)}"\.\Mesh.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pointer.hpp"\
{$(INCLUDE)}"\Common\Stdio.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Mainwnd.obj" : $(SOURCE) $(DEP_CPP_MAINW) "$(INTDIR)"
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
DEP_CPP_MAINW=\
{$(INCLUDE)}"\.\Mainwnd.hpp"\
{$(INCLUDE)}"\.\Mesh.hpp"\
{$(INCLUDE)}"\.\Polypnt.hpp"\
{$(INCLUDE)}"\.\Segment.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Pointer.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Stdio.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Mainwnd.obj" : $(SOURCE) $(DEP_CPP_MAINW) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Mesh.cpp
!IF "$(CFG)" == "mesh - Win32 Release"
DEP_CPP_MESH_=\
{$(INCLUDE)}"\.\Main.hpp"\
{$(INCLUDE)}"\.\Mesh.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Stdio.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Mesh.obj" : $(SOURCE) $(DEP_CPP_MESH_) "$(INTDIR)"
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
DEP_CPP_MESH_=\
{$(INCLUDE)}"\.\Main.hpp"\
{$(INCLUDE)}"\.\Mesh.hpp"\
{$(INCLUDE)}"\.\Polypnt.hpp"\
{$(INCLUDE)}"\.\Segment.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Fixup.hpp"\
{$(INCLUDE)}"\Common\Gdiobj.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Math.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pen.hpp"\
{$(INCLUDE)}"\Common\Point.hpp"\
{$(INCLUDE)}"\Common\Purehdc.hpp"\
{$(INCLUDE)}"\Common\Pvector.hpp"\
{$(INCLUDE)}"\Common\Pvector.tpp"\
{$(INCLUDE)}"\Common\Rect.hpp"\
{$(INCLUDE)}"\Common\Rgbcolor.hpp"\
{$(INCLUDE)}"\Common\Stdio.hpp"\
{$(INCLUDE)}"\Common\Stdlib.hpp"\
{$(INCLUDE)}"\Common\String.hpp"\
{$(INCLUDE)}"\Common\Types.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Mesh.obj" : $(SOURCE) $(DEP_CPP_MESH_) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Polypnt.cpp
DEP_CPP_POLYP=\
{$(INCLUDE)}"\.\Polypnt.hpp"\
{$(INCLUDE)}"\Common\Gdipoint.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
"$(INTDIR)\Polypnt.obj" : $(SOURCE) $(DEP_CPP_POLYP) "$(INTDIR)"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\Main.cpp
DEP_CPP_MAIN_=\
{$(INCLUDE)}"\.\Main.hpp"\
{$(INCLUDE)}"\.\Mainwnd.hpp"\
{$(INCLUDE)}"\Common\Assert.hpp"\
{$(INCLUDE)}"\Common\Block.hpp"\
{$(INCLUDE)}"\Common\Block.tpp"\
{$(INCLUDE)}"\Common\Callback.hpp"\
{$(INCLUDE)}"\Common\Callback.tpp"\
{$(INCLUDE)}"\Common\Cbdata.hpp"\
{$(INCLUDE)}"\Common\Cbptr.hpp"\
{$(INCLUDE)}"\Common\Guiwnd.hpp"\
{$(INCLUDE)}"\Common\Pcallbck.hpp"\
{$(INCLUDE)}"\Common\Pointer.hpp"\
{$(INCLUDE)}"\Common\Vhandler.hpp"\
{$(INCLUDE)}"\Common\Window.hpp"\
{$(INCLUDE)}"\Common\Windows.hpp"\
{$(INCLUDE)}"\Common\Windowsx.hpp"\
"$(INTDIR)\Main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)"
# End Source File
################################################################################
# Begin Source File
SOURCE=\work\exe\mscommon.lib
!IF "$(CFG)" == "mesh - Win32 Release"
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
!ENDIF
# End Source File
# End Target
# End Project
################################################################################

BIN
mesh/MESH.MDP Normal file

Binary file not shown.

46
mesh/MESH.PLG Normal file
View File

@@ -0,0 +1,46 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: mesh - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP21.tmp" with contents
[
/nologo /Gz /Zp8 /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp".\msvcobj/Mesh.pch" /YX /Fo".\msvcobj/" /Fd".\msvcobj/" /FD /c
"D:\work\mesh\Main.cpp"
"D:\work\mesh\Mainwnd.cpp"
"D:\work\mesh\Mesh.cpp"
"D:\work\mesh\Polypnt.cpp"
"D:\work\mesh\Segment.cpp"
]
Creating command line "cl.exe @C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP21.tmp"
Creating temporary file "C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP22.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /incremental:yes /pdb:".\msvcobj/Mesh.pdb" /debug /machine:I386 /out:".\msvcobj/Mesh.exe"
.\msvcobj\Main.obj
.\msvcobj\Mainwnd.obj
.\msvcobj\Mesh.obj
.\msvcobj\Polypnt.obj
.\msvcobj\Segment.obj
\work\exe\mscommon.lib
]
Creating command line "link.exe @C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP22.tmp"
<h3>Output Window</h3>
Compiling...
Main.cpp
Mainwnd.cpp
Mesh.cpp
Polypnt.cpp
Segment.cpp
Linking...
Creating library .\msvcobj/Mesh.lib and object .\msvcobj/Mesh.exp
<h3>Results</h3>
Mesh.exe - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

BIN
mesh/MESH.opt Normal file

Binary file not shown.

144
mesh/Mesh.001 Normal file
View File

@@ -0,0 +1,144 @@
# Microsoft Developer Studio Project File - Name="mesh" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=mesh - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Mesh.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Mesh.mak" CFG="mesh - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mesh - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "mesh - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mesh - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\msvcobj"
# PROP Intermediate_Dir ".\msvcobj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Zp1 /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "mesh - Win32 Release"
# Name "mesh - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\Main.cpp
# End Source File
# Begin Source File
SOURCE=.\Mainwnd.cpp
# End Source File
# Begin Source File
SOURCE=.\Mesh.cpp
# End Source File
# Begin Source File
SOURCE=..\exe\mscommon.lib
# End Source File
# Begin Source File
SOURCE=.\Polypnt.cpp
# End Source File
# Begin Source File
SOURCE=.\Segment.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\Main.hpp
# End Source File
# Begin Source File
SOURCE=.\Mainwnd.hpp
# End Source File
# Begin Source File
SOURCE=.\Mesh.hpp
# End Source File
# Begin Source File
SOURCE=.\Polypnt.hpp
# End Source File
# Begin Source File
SOURCE=.\Segment.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

141
mesh/Mesh.dsp Normal file
View File

@@ -0,0 +1,141 @@
# Microsoft Developer Studio Project File - Name="mesh" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=mesh - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Mesh.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Mesh.mak" CFG="mesh - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mesh - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "mesh - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mesh - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "mesh - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\msvcobj"
# PROP Intermediate_Dir ".\msvcobj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /Gz /Zp8 /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "mesh - Win32 Release"
# Name "mesh - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\Main.cpp
# End Source File
# Begin Source File
SOURCE=.\Mainwnd.cpp
# End Source File
# Begin Source File
SOURCE=.\Mesh.cpp
# End Source File
# Begin Source File
SOURCE=.\Polypnt.cpp
# End Source File
# Begin Source File
SOURCE=.\Segment.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\Main.hpp
# End Source File
# Begin Source File
SOURCE=.\Mainwnd.hpp
# End Source File
# Begin Source File
SOURCE=.\Mesh.hpp
# End Source File
# Begin Source File
SOURCE=.\Polypnt.hpp
# End Source File
# Begin Source File
SOURCE=.\Segment.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

85
mesh/SCRAPS.TXT Normal file
View File

@@ -0,0 +1,85 @@
#if 0
void Segment::drawSegment(HDC hDC,HPEN hPen)const
{
DWORD currentPosition;
HPEN hOldPen(0);
int saveMode;
saveMode=::SetROP2(hDC,R2_NOT);
if(hPen)hOldPen=(HPEN)::SelectObject(hDC,hPen);
currentPosition=::GetCurrentPosition(hDC);
::MoveTo(hDC,mFirstPoint.xPoint(),mFirstPoint.yPoint());
::LineTo(hDC,mSecondPoint.xPoint(),mSecondPoint.yPoint());
::MoveTo(hDC,LOWORD(currentPosition),HIWORD(currentPosition));
if(hOldPen)::SelectObject(hDC,hOldPen);
::SetROP2(hDC,saveMode);
}
#endif
// getBoundingRect(mCurrentIntersection,boundingRect);
// invalidate(boundingRect,FALSE);
void GridMesh::drawBoundingRect(const Rect &boundingRect)
{
Pen drawingPen(RGBColor(0,255,0),1);
PureDevice displayDevice(*this);
displayDevice.line(Point(boundingRect.left(),boundingRect.top()),Point(boundingRect.right(),boundingRect.top()),drawingPen);
displayDevice.line(Point(boundingRect.right(),boundingRect.top()),Point(boundingRect.right(),boundingRect.bottom()),drawingPen);
displayDevice.line(Point(boundingRect.right(),boundingRect.bottom()),Point(boundingRect.left(),boundingRect.bottom()),drawingPen);
displayDevice.line(Point(boundingRect.left(),boundingRect.bottom()),Point(boundingRect.left(),boundingRect.top()),drawingPen);
}
/*
void GridMesh::mouseUp(int x,int y)
{
Rect boundingRect;
GDIPoint swapPoint;
GDIPoint mousePoint;
size_t size;
int index;
if(InActive==mStatus)return;
mStatus=InActive;
mousePoint.setPoint(x,y);
size=(int)mCurrentIntersection.size();
for(index=0;index<size;index++)PureVector<Segment>::operator[](mCurrentIntersection[index].vectorIndex())=mCurrentIntersection[index];
PureDevice displayDevice(*this);
size=(int)PureVector<Segment>::size();
for(int i=0;i<size;i++)(PureVector<Segment>::operator[](i)).drawSegment(displayDevice,mDrawingPen);
invalidate();
update();
} */
void GridMesh::mouseUp(int x,int y)
{
Rect boundingRect;
GDIPoint swapPoint;
GDIPoint mousePoint;
size_t size;
int index;
if(InActive==mStatus)return;
mStatus=InActive;
mousePoint.setPoint(x,y);
size=(int)mCurrentIntersection.size();
for(index=0;index<size;index++)PureVector<Segment>::operator[](mCurrentIntersection[index].vectorIndex())=mCurrentIntersection[index];
PureDevice displayDevice(*this);
size=(int)PureVector<Segment>::size();
// for(int i=0;i<size;i++)(PureVector<Segment>::operator[](i)).drawSegment(displayDevice,mDrawingPen,true);
getBoundingRect(mCurrentIntersection,boundingRect);
// invalidate(FALSE);
// drawBoundingRect(boundingRect);
// invalidate(boundingRect,FALSE);
update();
}

14
mesh/main.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include <mesh/main.hpp>
#include <mesh/mainwnd.hpp>
HINSTANCE Main::smhInstance=0;
HINSTANCE Main::smhPrevInstance=0;
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR /*lpszCmdLine*/,int nCmdShow)
{
Main::processInstance(hInstance);
Main::previousProcessInstance(hPrevInstance);
Main::cmdShow(nCmdShow);
MainWindow applicationWindow;
return applicationWindow.messageLoop();
}

67
mesh/main.hpp Normal file
View File

@@ -0,0 +1,67 @@
#ifndef _MESH_MAIN_HPP_
#define _MESH_MAIN_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class Main
{
public:
static HINSTANCE processInstance(HWND hWnd);
static HINSTANCE processInstance(void);
static HINSTANCE previousProcessInstance(void);
static void processInstance(HINSTANCE processInstance);
static void previousProcessInstance(HINSTANCE previousProcessInstance);
static void cmdShow(int nCmdShow);
private:
static HINSTANCE smhInstance;
static HINSTANCE smhPrevInstance;
static int smnCmdShow;
};
inline
void Main::processInstance(HINSTANCE hProcessInstance)
{
smhInstance=hProcessInstance;
}
inline
void Main::previousProcessInstance(HINSTANCE previousProcessInstance)
{
smhPrevInstance=previousProcessInstance;
}
inline
void Main::cmdShow(int nCmdShow)
{
}
inline
HINSTANCE Main::processInstance(void)
{
return smhInstance;
}
inline
HINSTANCE Main::previousProcessInstance(void)
{
return smhPrevInstance;
}
#if defined(__FLAT__)
inline
HINSTANCE Main::processInstance(HWND hWnd)
{
return (HINSTANCE)::GetWindowLong(hWnd,GWL_HINSTANCE);
}
#else
inline
HINSTANCE Main::processInstance(HWND hWnd)
{
return (HINSTANCE)::GetWindowWord(hWnd,GWW_HINSTANCE);
}
#endif
#define WM_REACTIVATE WM_USER+1
#endif

101
mesh/mainwnd.cpp Normal file
View File

@@ -0,0 +1,101 @@
#include <mesh/mainwnd.hpp>
#include <mesh/mesh.hpp>
#include <common/assert.hpp>
char MainWindow::smszClassName[]="Proto";
char MainWindow::smszMenuName[]="";
MainWindow::MainWindow(void)
{
mPaintHandler.setCallback(this,&MainWindow::paintHandler);
mDestroyHandler.setCallback(this,&MainWindow::destroyHandler);
mCommandHandler.setCallback(this,&MainWindow::commandHandler);
mSizeHandler.setCallback(this,&MainWindow::sizeHandler);
mCreateHandler.setCallback(this,&MainWindow::createHandler);
insertHandlers();
registerClass();
::CreateWindow(smszClassName,smszClassName,
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_DLGFRAME|WS_CLIPCHILDREN,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,processInstance(),(LPSTR)this);
show(SW_SHOW);
update();
mGridMesh=new GridMesh(*this,width(),height(),GridMesh::Show);
}
MainWindow::~MainWindow()
{
destroy();
}
void MainWindow::insertHandlers(void)
{
Window::insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
Window::insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
Window::insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
Window::insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
Window::insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
}
void MainWindow::removeHandlers(void)
{
Window::removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
Window::removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
Window::removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
Window::removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
Window::removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
}
void MainWindow::registerClass(void)const
{
HINSTANCE hInstance(processInstance());
WNDCLASS wndClass;
if(::GetClassInfo(hInstance,smszClassName,(WNDCLASS FAR*)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|CS_OWNDC;
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(MainWindow*);
wndClass.hInstance =hInstance;
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground =(HBRUSH)::GetStockObject(BLACK_BRUSH);
wndClass.lpszMenuName =smszMenuName;
wndClass.lpszClassName =smszClassName;
::RegisterClass(&wndClass);
assert(0!=::GetClassInfo(hInstance,smszClassName,(WNDCLASS FAR*)&wndClass));
}
CallbackData::ReturnType MainWindow::createHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::destroyHandler(CallbackData &/*someCallbackData*/)
{
removeHandlers();
::PostQuitMessage(0);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::sizeHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::commandHandler(CallbackData &someCallbackData)
{
switch(someCallbackData.wParam())
{
default :
break;
}
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::paintHandler(CallbackData &someCallbackData)
{
return (CallbackData::ReturnType)FALSE;
}

43
mesh/mainwnd.hpp Normal file
View File

@@ -0,0 +1,43 @@
#ifndef _MESH_MAINWINDOW_HPP_
#define _MESH_MAINWINDOW_HPP_
#ifndef _COMMON_WINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
class GridMesh;
class MainWindow : public Window
{
public:
MainWindow(void);
virtual ~MainWindow();
int messageLoop(void)const;
private:
void registerClass(void)const;
void insertHandlers(void);
void removeHandlers(void);
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
Callback<MainWindow> mPaintHandler;
Callback<MainWindow> mDestroyHandler;
Callback<MainWindow> mCommandHandler;
Callback<MainWindow> mSizeHandler;
Callback<MainWindow> mCreateHandler;
SmartPointer<GridMesh> mGridMesh;
static char smszClassName[];
static char smszMenuName[];
};
inline
int MainWindow::messageLoop(void)const
{
return Window::messageLoop();
}
#endif

495
mesh/mesh.cpp Normal file
View File

@@ -0,0 +1,495 @@
#include <mesh/mesh.hpp>
#include <mesh/main.hpp>
#include <common/stdio.hpp>
#include <common/math.hpp>
#include <common/rect.hpp>
#include <common/purehdc.hpp>
char GridMesh::szClassName[]="MESH97A";
char GridMesh::szMenuName[]={'\0'};
GridMesh::GridMesh(HWND hParent,int width,int height,GridShow visibility)
: mhParent(hParent), mStatus(InActive), mGridLines(GridLines),
mIsSuspended(FALSE), mhInstance(Main::processInstance()),
mDrawingPen(RGBColor(0,0,0),1)
{
mCreateHandler.setCallback(this,&GridMesh::createHandler);
mPaintHandler.setCallback(this,&GridMesh::paintHandler);
mLeftButtonUpHandler.setCallback(this,&GridMesh::leftButtonUpHandler);
mLeftButtonDownHandler.setCallback(this,&GridMesh::leftButtonDownHandler);
mMouseMoveHandler.setCallback(this,&GridMesh::mouseMoveHandler);
mDestroyHandler.setCallback(this,&GridMesh::destroyHandler);
insertHandlers();
mVersionInfo=szClassName;
registerClass();
Rect winRect(CW_USEDEFAULT,CW_USEDEFAULT,width,height);
createWindow(WS_EX_TRANSPARENT,szClassName,String(),WS_CHILD|WS_CLIPSIBLINGS,winRect,mhParent,(HMENU)0,processInstance(),(LPSTR)(Window*)this);
if(GridMesh::Show!=visibility)return;
show(SW_SHOW);
update();
}
GridMesh::~GridMesh()
{
Window::destroy();
removeHandlers();
}
void GridMesh::insertHandlers(void)
{
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
insertHandler(VectorHandler::LeftButtonUpHandler,&mLeftButtonUpHandler);
insertHandler(VectorHandler::LeftButtonDownHandler,&mLeftButtonDownHandler);
insertHandler(VectorHandler::MouseMoveHandler,&mMouseMoveHandler);
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
}
void GridMesh::removeHandlers(void)
{
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
removeHandler(VectorHandler::LeftButtonUpHandler,&mLeftButtonUpHandler);
removeHandler(VectorHandler::LeftButtonDownHandler,&mLeftButtonDownHandler);
removeHandler(VectorHandler::MouseMoveHandler,&mMouseMoveHandler);
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
}
void GridMesh::registerClass(void)
{
WNDCLASS wndClass;
if(::GetClassInfo(mhInstance,szClassName,(WNDCLASS FAR *)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(GridMesh*);
wndClass.hInstance =mhInstance;
wndClass.hIcon =0;
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground =(HBRUSH)::GetStockObject(NULL_BRUSH);;
wndClass.lpszMenuName =szMenuName;
wndClass.lpszClassName =szClassName;
::RegisterClass(&wndClass);
}
CallbackData::ReturnType GridMesh::createHandler(CallbackData &/*someCallbackData*/)
{
sendMessage(WM_NCACTIVATE,TRUE,0L);
newMesh();
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType GridMesh::paintHandler(CallbackData &someCallbackData)
{
int segmentCount((int)Array<Segment>::size());
PaintInformation *pPaintInfo=(PaintInformation*)someCallbackData.lParam();
PureDevice &pureDevice=*pPaintInfo;
for(int itemIndex=0;itemIndex<segmentCount;itemIndex++)
(Array<Segment>::operator[](itemIndex)).drawSegment((PureDevice&)*pPaintInfo,mDrawingPen);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType GridMesh::leftButtonUpHandler(CallbackData &someCallbackData)
{
mouseUp(someCallbackData.loWord(),someCallbackData.hiWord());
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType GridMesh::leftButtonDownHandler(CallbackData &someCallbackData)
{
mouseDown(someCallbackData.loWord(),someCallbackData.hiWord());
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType GridMesh::mouseMoveHandler(CallbackData &someCallbackData)
{
mouseMove(someCallbackData.loWord(),someCallbackData.hiWord());
return FALSE;
}
CallbackData::ReturnType GridMesh::destroyHandler(CallbackData &someCallbackData)
{
return (CallbackData::ReturnType)FALSE;
}
void GridMesh::showWindow(int visible)
{
show(visible?SW_SHOW:SW_HIDE);
invalidate();
}
void GridMesh::newMesh(WORD gridLines)
{
createMesh(gridLines,(Array<Segment>&)*this);
::InvalidateRect(mhParent,0,TRUE);
invalidate();
}
void GridMesh::createMesh(WORD gridLines,Array<Segment> &someSegmentVector)
{
RECT clientRect;
WORD xLength;
WORD yLength;
GDIPoint tempFirstPoint;
GDIPoint tempSecondPoint;
WORD vectorSize(0);
Index vectorIndex(0);
if(gridLines>MaxGridLines)mGridLines=GridLines;
else mGridLines=gridLines;
::GetClientRect(*this,(RECT FAR *)&clientRect);
xLength=clientRect.right/(mGridLines+1);
yLength=clientRect.bottom/(mGridLines+1);
for(int x=0,xCount=0;xCount<=mGridLines;x+=xLength,xCount++)
for(int y=0,yCount=0;yCount<=mGridLines;y+=yLength,yCount++)vectorSize+=2;
someSegmentVector.size(vectorSize);
for(x=0,xCount=0;xCount<=mGridLines;x+=xLength,xCount++)
{
for(int y=0,yCount=0;yCount<=mGridLines;y+=yLength,yCount++)
{
tempFirstPoint.setPoint(x+xLength,y+yLength);
tempSecondPoint.setPoint(x+xLength,y);
someSegmentVector[vectorIndex]=Segment(tempFirstPoint,tempSecondPoint,(WORD)vectorIndex);
vectorIndex++;
tempSecondPoint.setPoint(x,y+yLength);
someSegmentVector[vectorIndex]=Segment(tempFirstPoint,tempSecondPoint,(WORD)vectorIndex);
vectorIndex++;
}
}
}
void GridMesh::mouseDown(int x,int y)
{
GDIPoint mousePoint;
size_t size;
if(mIsSuspended)return;
mCurrentIntersection.remove();
mousePoint.setPoint(x,y);
if(!closestIntersection(mCurrentIntersection,mousePoint))
{
mStatus=InActive;
::MessageBeep(-1);
return;
}
mStatus=Active;
PureDevice displayDevice(*this);
size=(int)mCurrentIntersection.size();
for(int i=0;i<size;i++)mCurrentIntersection[i].drawSegment(displayDevice,mDrawingPen);
for(i=0;i<size;i++)mCurrentIntersection[i].drawSegment(displayDevice,mDrawingPen);
}
void GridMesh::mouseMove(int x,int y)
{
GDIPoint mousePoint;
Rect boundingRect;
size_t size;
int index;
if(InActive==mStatus)return;
PureDevice displayDevice(*this);
mousePoint.setPoint(x,y);
size=(int)mCurrentIntersection.size();
getBoundingRect(mCurrentIntersection,boundingRect);
if(!boundingRect.ptInRect(mousePoint))return;
for(index=0;index<size;index++)mCurrentIntersection[index].drawSegment(displayDevice,mDrawingPen);
for(index=0;index<size;index++)mCurrentIntersection[index].firstPoint(mousePoint);
for(index=0;index<size;index++)mCurrentIntersection[index].drawSegment(displayDevice,mDrawingPen);
}
void GridMesh::mouseUp(int x,int y)
{
Rect boundingRect;
GDIPoint swapPoint;
GDIPoint mousePoint;
size_t size;
int index;
if(InActive==mStatus)return;
mStatus=InActive;
mousePoint.setPoint(x,y);
size=(int)mCurrentIntersection.size();
for(index=0;index<size;index++)Array<Segment>::operator[](mCurrentIntersection[index].vectorIndex())=mCurrentIntersection[index];
}
WORD GridMesh::closestIntersection(Block<Segment> &filterBlock,GDIPoint &mousePoint)
{
size_t size((int)Array<Segment>::size());
DWORD tempDistance;
DWORD leastDistance;
Segment tempSegment;
Segment minSegment;
if(!size)return FALSE;
filterBlock.remove();
while(IntersectionSegments!=filterBlock.size())
{
for(int index=0;index<size;index++)
{
if(!index)
{
tempSegment=Array<Segment>::operator[](index);
while(isInBlock(filterBlock,tempSegment))tempSegment=Array<Segment>::operator[](++index);
leastDistance=minDistance(tempSegment,mousePoint);
}
else
{
tempDistance=minDistance(Array<Segment>::operator[](index),mousePoint);
if(tempDistance<leastDistance)
{
minSegment=Array<Segment>::operator[](index);
if(!isInBlock(filterBlock,minSegment))
{
tempSegment=minSegment;
leastDistance=tempDistance;
}
}
}
}
filterBlock.insert(&tempSegment);
}
return orderIntersection(filterBlock);
}
WORD GridMesh::orderIntersection(Block<Segment> &intersection)
{
GDIPoint tempPoint;
GDIPoint swapPoint;
size_t size((int)intersection.size());
int firstSection(0);
int secondSection(0);
int index;
if(IntersectionSegments!=size)return FALSE;
tempPoint=intersection[0].firstPoint();
firstSection=(tempPoint==intersection[1].firstPoint());
if(!firstSection)firstSection=(tempPoint==intersection[1].secondPoint());
if(!firstSection)
{
tempPoint=intersection[0].secondPoint();
secondSection=tempPoint==intersection[1].firstPoint();
if(!secondSection)secondSection=tempPoint==intersection[1].secondPoint();
}
if(!firstSection && !secondSection)return FALSE;
for(index=1;index<size;index++)
{
if(!(tempPoint==intersection[index].firstPoint())&&
!(tempPoint==intersection[index].secondPoint()))return FALSE;
}
if(secondSection)
{
swapPoint=intersection[0].firstPoint();
intersection[0].firstPoint(intersection[0].secondPoint());
intersection[0].secondPoint(swapPoint);
}
for(index=1;index<size;index++)
{
if(!(tempPoint==intersection[index].firstPoint()))
{
intersection[index].secondPoint(intersection[index].firstPoint());
intersection[index].firstPoint(tempPoint);
}
}
return TRUE;
}
WORD GridMesh::isInBlock(Block<Segment> &source,Segment &someSegment)
{
size_t size((int)source.size());
for(int i=0;i<size;i++)if(source[i]==someSegment)return TRUE;
return FALSE;
}
DWORD GridMesh::minDistance(const Segment &someSegment,const GDIPoint &somePoint)
{
LONG yTemp;
LONG xTemp;
LONG midy;
LONG midx;
LONG distancePointOne;
LONG distancePointTwo;
LONG distancePointThree;
yTemp=((LONG)someSegment.yFirst()-(LONG)somePoint.y())*((LONG)someSegment.yFirst()-(LONG)somePoint.y());
xTemp=((LONG)someSegment.xFirst()-(LONG)somePoint.x())*((LONG)someSegment.xFirst()-(LONG)somePoint.x());
distancePointOne=Math::sqrt(yTemp+xTemp);
yTemp=((LONG)someSegment.ySecond()-(LONG)somePoint.y())*((LONG)someSegment.ySecond()-(LONG)somePoint.y());
xTemp=((LONG)someSegment.xSecond()-(LONG)somePoint.x())*((LONG)someSegment.xSecond()-(LONG)somePoint.x());
distancePointTwo=Math::sqrt(yTemp+xTemp);
midx=((LONG)someSegment.xFirst()+(LONG)someSegment.xSecond())/2;
midy=((LONG)someSegment.yFirst()+(LONG)someSegment.ySecond())/2;
yTemp=((LONG)midy-(LONG)somePoint.y())*((LONG)midy-(LONG)somePoint.y());
xTemp=((LONG)midx-(LONG)somePoint.x())*((LONG)midx-(LONG)somePoint.x());
distancePointThree=Math::sqrt(yTemp+xTemp);
if(distancePointThree<=distancePointTwo&&distancePointTwo<=distancePointOne)
return distancePointThree;
if(distancePointTwo<=distancePointThree&&distancePointThree<=distancePointOne)
return distancePointTwo;
return distancePointOne;
}
WORD GridMesh::saveMesh(String &pathFileName)
{
FILE *fp;
GDIPoint tempPoint;
size_t size((int)Array<Segment>::size());
if(!size)return FALSE;
if(0==(fp=::fopen((LPSTR)pathFileName,"wb")))return FALSE;
::fwrite((void*)(LPSTR)mVersionInfo,::strlen(mVersionInfo),1,fp);
::fwrite((void*)&size,sizeof(size),1,fp);
::fwrite((void*)&mGridLines,sizeof(mGridLines),1,fp);
for(int i=0;i<size;i++)
{
tempPoint=Array<Segment>::operator[](i).firstPoint();
::fwrite((void *)&tempPoint,sizeof(GDIPoint),1,fp);
tempPoint=Array<Segment>::operator[](i).secondPoint();
::fwrite((void*)&tempPoint,sizeof(Point),1,fp);
}
::fclose(fp);
return TRUE;
}
WORD GridMesh::loadMesh(String &pathFileName)
{
FILE *fp;
GDIPoint firstPoint;
GDIPoint secondPoint;
String versionString;
int vectorIndex(0);
size_t size;
if(0==(fp=::fopen((LPSTR)pathFileName,"rb")))return upgradeStatus(FALSE);
versionString.reserve(String::MaxString);
::fread((void*)(LPSTR)versionString,::strlen(mVersionInfo),1,fp);
if(versionString!=mVersionInfo)
{
::fclose(fp);
return upgradeStatus(FALSE);
}
::fread((void*)&size,sizeof(size),1,fp);
::fread((void*)&mGridLines,sizeof(mGridLines),1,fp);
Array<Segment>::size(size);
for(int i=0;i<size;i++)
{
::fread((void*)&firstPoint,sizeof(Point),1,fp);
::fread((void*)&secondPoint,sizeof(Point),1,fp);
Array<Segment>::operator[](vectorIndex)=Segment(firstPoint,secondPoint,vectorIndex);
vectorIndex++;
}
::fclose(fp);
return upgradeStatus(TRUE);
}
WORD GridMesh::upgradeStatus(WORD retCode)const
{
if(!isVisible())show(SW_SHOW);
::InvalidateRect(mhParent,0,TRUE);
invalidate();
return retCode;
}
WORD GridMesh::retrieveMesh(Array<GDIPoint> &sourcePoints,Array<GDIPoint> &destPoints)
{
Array<Segment> sourceSegments;
createMesh(mGridLines,sourceSegments);
retrieveMesh(sourcePoints,sourceSegments);
retrieveMesh(destPoints,(Array<Segment>&)*this);
if(sourcePoints.size()!=destPoints.size())return FALSE;
return (WORD)sourcePoints.size();
}
WORD GridMesh::retrieveMesh(Array<GDIPoint> &meshPoints,Array<Segment> &someSegmentVector)const
{
Segment tempSegment;
int vectorIndex;
int pointIndex(0);
size_t vectorSize((int)someSegmentVector.size());
int haveFirstColumn(FALSE);
Array<Point> dummyPoint;
meshPoints.size(0);
meshPoints.size((mGridLines+2)*(mGridLines+2));
for(vectorIndex=0;vectorIndex<vectorSize;vectorIndex+=2)
{
if(!(vectorIndex%(mGridLines+1)))
{
if(!vectorIndex&&!haveFirstColumn)meshPoints[pointIndex++]=GDIPoint(0,0);
else if(haveFirstColumn)
{
if(someSegmentVector[vectorIndex].firstPoint().y()<
someSegmentVector[vectorIndex].secondPoint().y())
meshPoints[pointIndex++]=someSegmentVector[vectorIndex].firstPoint();
else
meshPoints[pointIndex++]=someSegmentVector[vectorIndex].secondPoint();
}
}
else if(vectorIndex<=(mGridLines*2)&&!haveFirstColumn)
{
tempSegment=someSegmentVector[vectorIndex-1];
if(tempSegment.firstPoint()==someSegmentVector[vectorIndex].firstPoint()||
tempSegment.firstPoint()==someSegmentVector[vectorIndex].secondPoint())
meshPoints[pointIndex++]=tempSegment.secondPoint();
else
meshPoints[pointIndex++]=tempSegment.firstPoint();
if(vectorIndex==mGridLines*2)
{
if(someSegmentVector[vectorIndex].firstPoint().y()<
someSegmentVector[vectorIndex].secondPoint().y())
meshPoints[pointIndex++]=GDIPoint(0,someSegmentVector[vectorIndex].secondPoint().y());
else
meshPoints[pointIndex++]=GDIPoint(0,someSegmentVector[vectorIndex].firstPoint().y());
}
}
else
{
if(!haveFirstColumn){haveFirstColumn=TRUE;vectorIndex=-2;continue;}
if(someSegmentVector[vectorIndex].firstPoint().y()<
someSegmentVector[vectorIndex].secondPoint().y())
meshPoints[pointIndex++]=someSegmentVector[vectorIndex].firstPoint();
else
meshPoints[pointIndex++]=someSegmentVector[vectorIndex].secondPoint();
if(!((vectorIndex+2)%(mGridLines+1)))
{
if(someSegmentVector[vectorIndex].firstPoint().y()<
someSegmentVector[vectorIndex].secondPoint().y())
meshPoints[pointIndex++]=someSegmentVector[vectorIndex].secondPoint();
else
meshPoints[pointIndex++]=someSegmentVector[vectorIndex].firstPoint();
}
}
}
return (WORD)meshPoints.size();
}
void GridMesh::getBoundingRect(Block<Segment> &currentIntersection,Rect &boundingRect)
{
for(int itemIndex=0;itemIndex<currentIntersection.size();itemIndex++)
{
const GDIPoint &firstPoint=currentIntersection[itemIndex].firstPoint();
const GDIPoint &secondPoint=currentIntersection[itemIndex].secondPoint();
if(!itemIndex)
{
boundingRect.left(firstPoint.x()<secondPoint.x()?firstPoint.x():secondPoint.x());
boundingRect.top(firstPoint.y()<secondPoint.y()?firstPoint.y():secondPoint.y());
boundingRect.right(firstPoint.x()>secondPoint.x()?firstPoint.x():secondPoint.x());
boundingRect.bottom(firstPoint.y()<secondPoint.y()?firstPoint.y():secondPoint.y());
}
else
{
GDIPoint minPoint;
GDIPoint maxPoint;
minPoint.x(firstPoint.x()<secondPoint.x()?firstPoint.x():secondPoint.x());
minPoint.y(firstPoint.y()<secondPoint.y()?firstPoint.y():secondPoint.y());
maxPoint.x(firstPoint.x()>secondPoint.x()?firstPoint.x():secondPoint.x());
maxPoint.y(firstPoint.y()>secondPoint.y()?firstPoint.y():secondPoint.y());
if(minPoint.x()<boundingRect.left())boundingRect.left(minPoint.x());
if(minPoint.y()<boundingRect.top())boundingRect.top(minPoint.y());
if(maxPoint.x()>boundingRect.right())boundingRect.right(maxPoint.x());
if(maxPoint.y()>boundingRect.bottom())boundingRect.bottom(maxPoint.y());
}
}
}

110
mesh/mesh.hpp Normal file
View File

@@ -0,0 +1,110 @@
#ifndef _MESH_MESH_HPP_
#define _MESH_MESH_HPP_
#ifndef _COMMON_STDIO_HPP_
#include <common/stdio.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_WINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _COMMON_CALLBACK_HPP_
#include <common/callback.hpp>
#endif
#ifndef _COMMON_ARRAY_HPP_
#include <common/array.hpp>
#endif
#ifndef _COMMON_PEN_HPP_
#include <common/pen.hpp>
#endif
#ifndef _MESH_SEGMENT_HPP_
#include <mesh/segment.hpp>
#endif
#ifndef _MESH_POLYPOINT_HPP_
#include <mesh/polypnt.hpp>
#endif
class GridMesh : public Array<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(Array<GDIPoint> &sourcePoints,Array<GDIPoint> &destPoints);
WORD rowCols(void)const;
WORD gridLines(void)const;
WORD upgradeStatus(WORD retCode)const;
// 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 mouseUp(int x,int y);
void mouseDown(int x,int y);
void mouseMove(int x,int y);
DWORD minDistance(const Segment &someSegment,const GDIPoint &mousePoint);
WORD closestIntersection(Block<Segment> &filterSegment,GDIPoint &mousePoint);
WORD orderIntersection(Block<Segment> &intersection);
WORD isInBlock(Block<Segment> &source,Segment &someSegment);
void createMesh(WORD gridLines,Array<Segment> &someSegmentVector);
WORD retrieveMesh(Array<GDIPoint> &meshPoints,Array<Segment> &meshSegments)const;
void getBoundingRect(Block<Segment> &currentIntersection,Rect &boundingRect);
void drawBoundingRect(const Rect &boundingRect);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
CallbackData::ReturnType leftButtonUpHandler(CallbackData &someCallbackData);
CallbackData::ReturnType leftButtonDownHandler(CallbackData &someCallbackData);
CallbackData::ReturnType mouseMoveHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
void insertHandlers(void);
void removeHandlers(void);
Callback<GridMesh> mCreateHandler;
Callback<GridMesh> mPaintHandler;
Callback<GridMesh> mLeftButtonUpHandler;
Callback<GridMesh> mLeftButtonDownHandler;
Callback<GridMesh> mMouseMoveHandler;
Callback<GridMesh> mDestroyHandler;
Pen mDrawingPen;
static char szClassName[];
static char szMenuName[];
Block<Segment> mCurrentIntersection;
int mGridLines;
Status mStatus;
String mVersionInfo;
WORD mIsSuspended;
HWND mhParent;
HINSTANCE mhInstance;
};
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

6
mesh/polypnt.cpp Normal file
View File

@@ -0,0 +1,6 @@
#include <mesh/polypnt.hpp>
PolyPoint::PolyPoint(const PolyPoint &somePolyPoint)
{
for(int pointIndex=0;pointIndex<MaxPoint;pointIndex++)mPolyPoint[pointIndex]=somePolyPoint.mPolyPoint[pointIndex];
}

35
mesh/polypnt.hpp Normal file
View File

@@ -0,0 +1,35 @@
#ifndef _MESH_POLYPOINT_HPP_
#define _MESH_POLYPOINT_HPP_
#ifndef _COMMON_GDIPOINT_HPP_
#include <common/gdipoint.hpp>
#endif
class PolyPoint
{
public:
enum {MaxPoint=4};
PolyPoint(void);
PolyPoint(const PolyPoint &somePolyPoint);
virtual ~PolyPoint();
GDIPoint &operator[](unsigned point);
private:
GDIPoint mPolyPoint[MaxPoint];
};
inline
PolyPoint::PolyPoint(void)
{
}
inline
PolyPoint::~PolyPoint()
{
}
inline
GDIPoint &PolyPoint::operator[](unsigned point)
{
if(point>=MaxPoint)return mPolyPoint[MaxPoint-1];
return mPolyPoint[point];
}
#endif

55
mesh/segment.cpp Normal file
View File

@@ -0,0 +1,55 @@
#include <mesh/segment.hpp>
#include <common/purehdc.hpp>
Segment::Segment()
{
}
Segment::~Segment()
{
}
Segment::Segment(const GDIPoint &firstPoint,const GDIPoint &secondPoint,WORD vectorIndex)
{
mFirstPoint=firstPoint;
mSecondPoint=secondPoint;
mVectorIndex=vectorIndex;
}
Segment::Segment(const Segment &someSegment)
{
mFirstPoint=someSegment.mFirstPoint;
mSecondPoint=someSegment.mSecondPoint;
mVectorIndex=someSegment.mVectorIndex;
}
WORD Segment::operator==(const Segment &someSegment)const
{
return ((mFirstPoint==someSegment.mFirstPoint &&
mSecondPoint==someSegment.mSecondPoint)||
(mFirstPoint==someSegment.mSecondPoint &&
mSecondPoint==someSegment.mFirstPoint));
}
void Segment::operator=(const Segment &someSegment)
{
mFirstPoint=someSegment.mFirstPoint;
mSecondPoint=someSegment.mSecondPoint;
mVectorIndex=someSegment.mVectorIndex;
}
void Segment::drawSegment(PureDevice &displayDevice,HPEN hPen,bool setROP)const
{
GDIPoint currentPosition;
HPEN hOldPen(0);
int saveMode;
if(setROP)saveMode=::SetROP2(displayDevice,R2_NOT);
if(hPen)hOldPen=(HPEN)::SelectObject(displayDevice,hPen);
::GetCurrentPositionEx(displayDevice,(POINT FAR*)&currentPosition);
::MoveToEx(displayDevice,mFirstPoint.x(),mFirstPoint.y(),(POINT FAR*)&currentPosition);
::LineTo(displayDevice,mSecondPoint.x(),mSecondPoint.y());
::MoveToEx(displayDevice,currentPosition.x(),currentPosition.y(),(POINT FAR*)&mSecondPoint);
if(hOldPen)::SelectObject(displayDevice,hOldPen);
if(setROP)::SetROP2(displayDevice,saveMode);
}

97
mesh/segment.hpp Normal file
View File

@@ -0,0 +1,97 @@
#ifndef _MESH_SEGMENT_HPP_
#define _MESH_SEGMENT_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_GDIPOINT_HPP_
#include <common/gdipoint.hpp>
#endif
class PureDevice;
class Segment
{
public:
Segment(void);
Segment(const GDIPoint &firstPoint,const GDIPoint &secondPoint,WORD vectorIndex);
Segment(const Segment &someSegment);
virtual ~Segment(void);
WORD operator==(const Segment &someSegment)const;
void operator=(const Segment &someSegment);
void drawSegment(PureDevice &displayDevice,HPEN hPen=0,bool setROP=true)const;
WORD vectorIndex(void)const;
WORD xFirst(void)const;
WORD xSecond(void)const;
WORD yFirst(void)const;
WORD ySecond(void)const;
const GDIPoint &firstPoint(void)const;
const GDIPoint &secondPoint(void)const;
void firstPoint(const GDIPoint &somePoint);
void secondPoint(const GDIPoint &somePoint);
GDIPoint leadingPoint(void)const;
private:
GDIPoint mFirstPoint;
GDIPoint mSecondPoint;
WORD mVectorIndex;
};
inline
WORD Segment::xFirst(void)const
{
return mFirstPoint.x();
}
inline
WORD Segment::xSecond(void)const
{
return mSecondPoint.x();
}
inline
WORD Segment::yFirst(void)const
{
return mFirstPoint.y();
}
inline
WORD Segment::ySecond(void)const
{
return mSecondPoint.y();
}
inline
const GDIPoint &Segment::firstPoint(void)const
{
return mFirstPoint;
}
inline
const GDIPoint &Segment::secondPoint(void)const
{
return mSecondPoint;
}
inline
void Segment::firstPoint(const GDIPoint &somePoint)
{
mFirstPoint=somePoint;
}
inline
void Segment::secondPoint(const GDIPoint &somePoint)
{
mSecondPoint=somePoint;
}
inline
GDIPoint Segment::leadingPoint(void)const
{
return (mFirstPoint.y()<mSecondPoint.y()?mSecondPoint:mFirstPoint);
}
inline
WORD Segment::vectorIndex(void)const
{
return mVectorIndex;
}
#endif