Files
Work/mesh/SCRAPS.TXT
2024-08-07 09:16:27 -04:00

86 lines
2.5 KiB
Plaintext

#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();
}