📄 pagemapstyleprop.cpp
字号:
/////////////////////////////////////////////////////////////////////////////////
void CPageMapStyleProp::OnOK()
{
m_pMapLayer->GetMapProp() = *m_pMapProperty;
CPropertyPage::OnOK();
}
///////////////////////////////////////////////////////////////////////////////
//
// For styles for which each mapobject has a different style, apply the new
// style when it changes
//
void CPageMapStyleProp::OnSelchangeLinestyle()
{
BOOL bSepColour = m_pMapProperty->m_nSepColour || m_pMapProperty->m_bRangeColour;
// Apply to separate colour selection
if (bSepColour)
{
// Get access to the layer page
CSheetMapProp *pSheet = (CSheetMapProp*)GetParent();
if (IsWindow(pSheet->m_pMapLayerProp->GetSafeHwnd()))
{
CListBoxStyle &lbLayers = pSheet->m_pMapLayerProp->GetLBLayers();
// Get the line style
int iLine = m_cbLineStyle.GetCurSel();
// Set it to the selected layers
for (int i = 0; i < lbLayers.GetCount(); i++)
{
if (lbLayers.GetSel(i) || lbLayers.GetSelCount() == 0)
{
CMapStyle style = lbLayers.GetStyle(i);
style.m_nLineStyle = m_cbLineStyle.GetStyle(iLine);
style.m_nLineWidth = m_cbLineStyle.GetWidth(iLine);
lbLayers.SetStyle(i, style);
};
};
};
}
}
///////////////////////////////////////////////////////////////////////////////
void CPageMapStyleProp::OnSelchangeFillstyle()
{
BOOL bSepColour = m_pMapProperty->m_nSepColour || m_pMapProperty->m_bRangeColour;
// Apply to separate colour selection
if (bSepColour)
{
// Get access to the layer page
CSheetMapProp *pSheet = (CSheetMapProp*)GetParent();
if (IsWindow(pSheet->m_pMapLayerProp->GetSafeHwnd()))
{
CListBoxStyle &lbLayers = pSheet->m_pMapLayerProp->GetLBLayers();
// Get the line style
int iLine = m_cbPattern.GetCurSel();
// Set it to the selected layers
for (int i = 0; i < lbLayers.GetCount(); i++)
{
if (lbLayers.GetSel(i) || lbLayers.GetSelCount() == 0)
{
CMapStyle style = lbLayers.GetStyle(i);
style.m_nPattern = m_cbPattern.GetPattern(iLine);
style.m_nHatch = m_cbPattern.GetHatch(iLine);
lbLayers.SetStyle(i, style);
};
};
};
}
}
///////////////////////////////////////////////////////////////////////////////
void CPageMapStyleProp::OnSelchangeSymbol()
{
BOOL bSepColour = m_pMapProperty->m_nSepColour || m_pMapProperty->m_bRangeColour;
// Apply to separate colour selection
if (bSepColour)
{
// Get access to the layer page
CSheetMapProp *pSheet = (CSheetMapProp*)GetParent();
if (IsWindow(pSheet->m_pMapLayerProp->GetSafeHwnd()))
{
CListBoxStyle &lbLayers = pSheet->m_pMapLayerProp->GetLBLayers();
// Get the symbol
int iSym = m_cbSymbol.GetCurSel();
// Set it to the selected layers
for (int i = 0; i < lbLayers.GetCount(); i++)
{
if (lbLayers.GetSel(i) || lbLayers.GetSelCount() == 0)
{
CMapStyle style = lbLayers.GetStyle(i);
style.m_nSymbol = m_cbSymbol.GetStyle(iSym).m_nSymbol;
lbLayers.SetStyle(i, style);
};
};
};
}
}
///////////////////////////////////////////////////////////////////////////////
void CPageMapStyleProp::OnSelchangeSymsize()
{
BOOL bSepColour = m_pMapProperty->m_nSepColour || m_pMapProperty->m_bRangeColour;
// Apply to separate colour selection
if (bSepColour)
{
// Get access to the layer page
CSheetMapProp *pSheet = (CSheetMapProp*)GetParent();
if (IsWindow(pSheet->m_pMapLayerProp->GetSafeHwnd()))
{
CListBoxStyle &lbLayers = pSheet->m_pMapLayerProp->GetLBLayers();
// Get the symbol
int iSym = m_cbSymSize.GetCurSel();
// Set it to the selected layers
for (int i = 0; i < lbLayers.GetCount(); i++)
{
if (lbLayers.GetSel(i) || lbLayers.GetSelCount() == 0)
{
CMapStyle style = lbLayers.GetStyle(i);
style.m_dSymSize = m_cbSymSize.GetItemData(iSym);
lbLayers.SetStyle(i, style);
};
};
};
}
}
///////////////////////////////////////////////////////////////////////////////
void CPageMapStyleProp::OnColorline()
{
BOOL bSepColour = m_pMapProperty->m_nSepColour || m_pMapProperty->m_bRangeColour;
if (bSepColour)
{
// Get access to the layer page
CSheetMapProp *pSheet = (CSheetMapProp*)GetParent();
if (IsWindow(pSheet->m_pMapLayerProp->GetSafeHwnd()))
{
CListBoxStyle &lbLayers = pSheet->m_pMapLayerProp->GetLBLayers();
// Set it to the selected layers
for (int i = 0; i < lbLayers.GetCount(); i++)
{
if (lbLayers.GetSel(i) || lbLayers.GetSelCount() == 0)
{
CMapStyle style = lbLayers.GetStyle(i);
style.m_crLine = m_pbColourLine.GetColour();
lbLayers.SetStyle(i, style);
};
};
};
}
}
///////////////////////////////////////////////////////////////////////////////
void CPageMapStyleProp::OnColorfill()
{
BOOL bSepColour = m_pMapProperty->m_nSepColour || m_pMapProperty->m_bRangeColour;
if (bSepColour)
{
// Get access to the layer page
CSheetMapProp *pSheet = (CSheetMapProp*)GetParent();
if (IsWindow(pSheet->m_pMapLayerProp->GetSafeHwnd()))
{
CListBoxStyle &lbLayers = pSheet->m_pMapLayerProp->GetLBLayers();
// Set it to the selected layers
for (int i = 0; i < lbLayers.GetCount(); i++)
{
if (lbLayers.GetSel(i) || lbLayers.GetSelCount() == 0)
{
CMapStyle style = lbLayers.GetStyle(i);
style.m_crFill = m_pbColourFill.GetColour();
lbLayers.SetStyle(i, style);
};
};
};
}
}
///////////////////////////////////////////////////////////////////////////////
//
// Display symbols menu
//
void CPageMapStyleProp::OnSymbolMenu()
{
CMenu menu;
menu.LoadMenu(IDR_SYMBOLS);
CMenu* pMenu = menu.GetSubMenu(0);
// Display
CRect rect;
m_pbSymbolMenu.GetWindowRect(&rect);
pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
rect.right, rect.top, this);
}
///////////////////////////////////////////////////////////////////////////////
//
// Add a new custom symbol
//
void CPageMapStyleProp::OnSymbolsAdd()
{
if (m_cbSymbol.AddSymbol())
{
// Reinitialise list
int iSym = m_cbSymbol.GetCurSel();
CMapStyle mapstyle;
mapstyle = m_cbSymbol.GetStyle(iSym);
m_cbSymbol.Initialise(mapstyle);
};
}
///////////////////////////////////////////////////////////////////////////////
//
// Delete an existing custom symbol
//
void CPageMapStyleProp::OnSymbolsDelete()
{
if (m_cbSymbol.DeleteSymbol())
{
// Reinitialise list
int iSym = m_cbSymbol.GetCurSel();
CMapStyle mapstyle;
mapstyle = m_cbSymbol.GetStyle(iSym);
m_cbSymbol.Initialise(mapstyle);
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -