Iets efficienter
Release Markers svn path=/Slnkdwf/trunk/; revision=12515
This commit is contained in:
@@ -192,7 +192,7 @@ CSize &CWhip2DCImpl::get_Size()
|
||||
return m_State.m_Size;
|
||||
}
|
||||
|
||||
STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW)
|
||||
STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, VARIANT_BOOL markers /* = VARIANT_FALSE */)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
/// CneutralGDI neutralGDI("CWhip2DCImpl::Paint");
|
||||
@@ -322,52 +322,56 @@ STDMETHODIMP CWhip2DCImpl::Paint(VARIANT_BOOL forceBW)
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Toon bij sterk inzoomen een raster van DWF-punten ter referentie
|
||||
LOGFONT lf;
|
||||
memset(&lf, 0, sizeof(LOGFONT)); // clear out structure.
|
||||
strncpy(lf.lfFaceName, "Tahoma", LF_FACESIZE);
|
||||
lf.lfHeight = -10;
|
||||
HFONT fnt = CreateFontIndirect(&lf);
|
||||
HGDIOBJ oldfont = SelectObject(m_State.myDC, fnt);
|
||||
markers = VARIANT_TRUE;
|
||||
#endif
|
||||
|
||||
if (m_State.m_mul > 10.0)
|
||||
if (markers)
|
||||
{
|
||||
CRect clip;
|
||||
GetClipBox(m_State.myDC,&clip); // Zichtbaar deel op scherm
|
||||
// Toon bij sterk inzoomen een raster van DWF-punten ter referentie
|
||||
LOGFONT lf;
|
||||
memset(&lf, 0, sizeof(LOGFONT)); // clear out structure.
|
||||
strncpy(lf.lfFaceName, "Tahoma", LF_FACESIZE);
|
||||
lf.lfHeight = -10;
|
||||
HFONT fnt = CreateFontIndirect(&lf);
|
||||
HGDIOBJ oldfont = SelectObject(m_State.myDC, fnt);
|
||||
|
||||
WT_Logical_Point topleft(m_State.LPToDWF(clip.TopLeft()));
|
||||
WT_Logical_Point botright(m_State.LPToDWF(clip.BottomRight()));
|
||||
for (int x = topleft.m_x; x <= botright.m_x; x++)
|
||||
for (int y = topleft.m_y; y >= botright.m_y; y--)
|
||||
{
|
||||
CPoint pt = m_State.DWFToLP(WT_Logical_Point(x, y));
|
||||
SetPixel(m_State.myDC, pt.x, pt.y, RGB(128,128,128));
|
||||
// Bij nog sterker inzoomen tonen we DWF-coordinaten
|
||||
if (m_State.m_mul > 80.0)
|
||||
if (m_State.m_mul > 10.0)
|
||||
{
|
||||
CRect clip;
|
||||
GetClipBox(m_State.myDC,&clip); // Zichtbaar deel op scherm
|
||||
|
||||
WT_Logical_Point topleft(m_State.LPToDWF(clip.TopLeft()));
|
||||
WT_Logical_Point botright(m_State.LPToDWF(clip.BottomRight()));
|
||||
for (int x = topleft.m_x; x <= botright.m_x; x++)
|
||||
for (int y = topleft.m_y; y >= botright.m_y; y--)
|
||||
{
|
||||
CString txt;
|
||||
txt.Format("%d", x);
|
||||
TextOut(m_State.myDC, pt.x+5, pt.y, txt, txt.GetLength());
|
||||
txt.Format("%d", y);
|
||||
TextOut(m_State.myDC, pt.x+5, pt.y+10, txt, txt.GetLength());
|
||||
CPoint pt = m_State.DWFToLP(WT_Logical_Point(x, y));
|
||||
SetPixel(m_State.myDC, pt.x, pt.y, RGB(128,128,128));
|
||||
// Bij nog sterker inzoomen tonen we DWF-coordinaten
|
||||
if (m_State.m_mul > 80.0)
|
||||
{
|
||||
CString txt;
|
||||
txt.Format("%d", x);
|
||||
TextOut(m_State.myDC, pt.x+5, pt.y, txt, txt.GetLength());
|
||||
txt.Format("%d", y);
|
||||
TextOut(m_State.myDC, pt.x+5, pt.y+10, txt, txt.GetLength());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SelectObject(m_State.myDC, oldfont);
|
||||
DeleteObject(fnt);
|
||||
}
|
||||
SelectObject(m_State.myDC, oldfont);
|
||||
DeleteObject(fnt);
|
||||
|
||||
// Pas op: geeft ASSERT's op te grote myRound binnen DWFToLP bij ver inzoomen
|
||||
// Pas op: geeft ASSERT's op te grote myRound binnen DWFToLP bij ver inzoomen
|
||||
#if 0
|
||||
//CPoint pt0 = m_State.DWFToLP(WT_Logical_Point(INT_MAX, 100000000));
|
||||
//CPoint pt1 = m_State.DWFToLP(WT_Logical_Point(INT_MAX, -100000000));
|
||||
HPEN m_pen = CreatePen(PS_SOLID, 3, RGB(255,255,0));
|
||||
HPEN oldpen = (HPEN) SelectObject(m_State.myDC, m_pen);
|
||||
MoveToEx(m_State.myDC, pt0.x, pt0.y, NULL);
|
||||
//CPoint pt0 = m_State.DWFToLP(WT_Logical_Point(INT_MAX, 100000000));
|
||||
//CPoint pt1 = m_State.DWFToLP(WT_Logical_Point(INT_MAX, -100000000));
|
||||
HPEN m_pen = CreatePen(PS_SOLID, 3, RGB(255,255,0));
|
||||
HPEN oldpen = (HPEN) SelectObject(m_State.myDC, m_pen);
|
||||
MoveToEx(m_State.myDC, pt0.x, pt0.y, NULL);
|
||||
|
||||
LineTo(m_State.myDC, pt1.x, pt1.y);
|
||||
LineTo(m_State.myDC, pt1.x, pt1.y);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -769,7 +773,8 @@ WT_Result CWhip2DCImpl::my_process_layer (WT_Layer & layer, WT_File & file)
|
||||
|
||||
file.layer_list().add_layer(layer);
|
||||
ll = &layer;
|
||||
m_State->m_Layernames.Add(layer.layer_name().ascii());
|
||||
if (m_State->m_Layernames.Find(layer.layer_name().ascii()) < 0)
|
||||
m_State->m_Layernames.Add(layer.layer_name().ascii());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -779,6 +784,10 @@ WT_Result CWhip2DCImpl::my_process_layer (WT_Layer & layer, WT_File & file)
|
||||
|
||||
if (ll)
|
||||
{
|
||||
// Overbodige lagen negeren we:
|
||||
if (ll->layer_name().ascii() == m_State->m_activeLayerName)
|
||||
return WT_Result::Success;
|
||||
|
||||
m_State->m_activeLayerName = ll->layer_name().ascii();
|
||||
|
||||
//myTRACE("\n my_output_file.desired_rendition().layer() = layer %s;", layer.layer_name().ascii());
|
||||
@@ -1772,7 +1781,7 @@ WT_Result CWhip2DCImpl::my_process_fillPattern (WT_Fill_Pattern & fillPattern, W
|
||||
|
||||
STDMETHODIMP CWhip2DCImpl::get_LayerCount(LONG* pVal)
|
||||
{
|
||||
(*pVal) = (LONG)m_State.m_Layernames.GetCount();
|
||||
(*pVal) = (LONG)m_State.m_Layernames.GetSize();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1796,10 +1805,10 @@ STDMETHODIMP CWhip2DCImpl::get_TextItem(LONG i, CFoundText &pVal)
|
||||
|
||||
STDMETHODIMP CWhip2DCImpl::get_LayerItem(LONG i, CString* pVal)
|
||||
{
|
||||
if (i<0 || i>=(LONG)m_State.m_Layernames.GetCount())
|
||||
if (i<0 || i>=(LONG)m_State.m_Layernames.GetSize())
|
||||
return E_INVALIDARG;
|
||||
|
||||
(*pVal) = m_State.m_Layernames.GetAt(i);
|
||||
(*pVal) = m_State.m_Layernames[i];
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user