📄 plottypelistcontrol.h
字号:
m_vnPlotTypes = nPolarSmithTernaryPlots;
else if (m_dwLayerBits == PCD_LAYER_SMITH)
m_vnPlotTypes = nPolarSmithTernaryPlots;
else if (m_dwLayerBits == PCD_LAYER_3D_XYY)
m_vnPlotTypes = n3DXYYPlots;
else
m_vnPlotTypes = nWksPlots;
}
else if(EXIST_MATRIX == nPageType)
m_vnPlotTypes = nMatPlots;
else
m_vnPlotTypes = nDatasetPlots;
int nIndexInList = removeInvalidPlotTypes(m_vnPlotTypes, nPlotID, dwAuxTypeInfo);
//---- CPY 10/7/03 QA70-5309 v7.5714 CUSTOM_PLOT_TYPE_BROKEN_BY_END_EDIT
//m_nCustomPlotID = 0;
if(nPlotID)
m_nCustomPlotID = 0;
//----
if(nPlotID && nIndexInList < 0)
{
m_nCustomPlotID = ConvertPlotIds(nPlotID, &dwAuxTypeInfo);//nPlotID;
m_nCustomPlotExVal = nPlotExVal;
m_nSelPlotType = nPlotID;
m_dwAuxTypeInfo = dwAuxTypeInfo;// CPY 8/26/03 SPECIAL_PLOT_TYPES_SUPPORT, we first store m_nSelPlotType and m_dwAuxTypeInfo with plot type info, then if not in list check m_nCustomPlotID
}
if(m_nCustomPlotID && m_nCustomPlotID != IDM_PLOT_UNKNOWN && (m_nCustomPlotExVal || isPlotTypeSpecial(m_nCustomPlotID, m_vnPlotTypes)))
{
m_nSelPlotType = IDM_PLOT_CUSTOM;
m_dwAuxTypeInfo = 0;
m_vnPlotTypes.InsertAt(0, IDM_PLOT_CUSTOM);
nIndexInList = 0;
}
else
m_nCustomPlotID = 0;
Update();
checkSelPlotType(nIndexInList, dwLTPlotInfo);
}
bool checkSelPlotType(int nIndexInList, DWORD dwLTPlotInfo = 0, bool bAlsoCheckBaseType = true, bool bSet1stIfNone = true)
{
if(!HasRows())
return false;
//----- CPY QA70-5134 9/22/03 v7.5701 BUBBLE_PLOT_EDIT_SEL_LINE
if(nIndexInList >= 0)
{
m_nSelPlotType = GetPlotTypeByIndex(nIndexInList);
m_dwAuxTypeInfo = 0;
SelRow(nIndexInList);
return true;
}
//-----
//int nRow = findPlotTypeRow(m_nSelPlotType);
////----- CPY 8/26/03 SPECIAL_PLOT_TYPES_SUPPORT
////DWORD dwAuxTypeInfoPlotTypeBits = m_dwAuxTypeInfo & PCD_PLOT_TYPE_AUX_BITS;
////int nPlotTypeSearch = ConvertPlotIds(m_nSelPlotType, &dwAuxTypeInfoPlotTypeBits);
//int nPlotTypeSearch = ConvertPlotIds(m_nSelPlotType, &m_dwAuxTypeInfo);
////----- end SPECIAL_PLOT_TYPES_SUPPORT
int nPlotTypeSearch = ConvertPlotIds(m_nSelPlotType, &m_dwAuxTypeInfo, &dwLTPlotInfo);
int nRow = findPlotTypeRow(nPlotTypeSearch);
if(nRow >= 0)
SelRow(nRow);
else if(bAlsoCheckBaseType)
{
if(m_nSelPlotType >0 && (nRow = findPlotTypeRow(m_nSelPlotType, true)) >= 0)
SelRow(nRow);
else
{
if(bSet1stIfNone)
{
// out_int("Cannot find sel plot type, setting it to 1st:", m_nSelPlotType);
m_nSelPlotType = GetPlotTypeByIndex();
m_dwAuxTypeInfo = 0;
return checkSelPlotType(-1, dwLTPlotInfo, true, false);
}
out_str("Error, Cannot find sel plot type at all!");
return false;
}
}
return true;
}
uint getSelPlotID(int* pPlotExVal = NULL)
{
uint nPlotID = 0;
int nPlotExVal = 0;
int nRow = GetSelectedRow();
if(nRow >= 0)
{
uint nPlotType;
int nn = m_flx.RowData(nRow);
if(0 == nn)
{
out_str("Err, we should never come here, better get out");
return 0;
}
m_nSelPlotType = nn;
if(IDM_PLOT_CUSTOM == m_nSelPlotType)
{
nPlotExVal = m_nCustomPlotExVal;
nPlotID = m_nCustomPlotID;
m_dwAuxTypeInfo = 0;
}
else
{
nPlotID = m_nSelPlotType;
getPlotType(nPlotID, &m_dwAuxTypeInfo);
}
}
if(pPlotExVal)
*pPlotExVal = nPlotExVal;
return nPlotID;
}
uint getPlotType(uint nPlotID, DWORD* pdwAuxTypeInfo = NULL)
{
DWORD dwAuxTypeInfo = 0, dwPlotInto = 0;
string strColPattern;
//---- CPY 9/9/03 v7.5689 TERNARY_PLOT_USE_2D_TYPES
//uint nPlotType = Project.GetPlotTypeInfo(nPlotID, dwAuxTypeInfo, dwPlotInto, strColPattern);
uint nPlotType = get_plot_type_info(nPlotID, m_nCurrentDataPageType, m_dwLayerBits, dwAuxTypeInfo, dwPlotInto, strColPattern);
//----
if(pdwAuxTypeInfo)
*pdwAuxTypeInfo = dwAuxTypeInfo;
return nPlotType;
}
string getPlotTypeStr(uint nPlotType)
{
if(IDM_PLOT_CUSTOM == nPlotType)
{
string str = "(";
str += GetPlotTypeName(getPlotType(m_nCustomPlotID));
str += ")";
return str;
}
return GetPlotTypeName(nPlotType);
}
int findPlotTypeRow(int nPlotType, bool bBaseType = false)
{
int nBaseType = get_base_plot_type(nPlotType);
for(int nRow = m_flx.FixedRows; nRow < m_flx.Rows; nRow++)
{
DWORD dw = m_flx.RowData(nRow);
if(bBaseType)
{
if(get_base_plot_type(dw) == nBaseType)
return nRow;
}
else if(dw == nPlotType)
return nRow;
}
return -1;
}
bool isTargetXYZLayer(bool& is3D)
{
if(PCD_LAYER_TRI == m_dwLayerBits || PCD_LAYER_3D == m_dwLayerBits)
{
is3D = (PCD_LAYER_3D == m_dwLayerBits)? true:false;
return true;
}
return false;
}
//return index in list if nPlotTypeCheckCompatible > 0 and is in vnPlotTypes
//return -1 if not in list
int removeInvalidPlotTypes(vector<uint>& vnPlotTypes, int nPlotTypeCheckCompatible = 0, DWORD dwAuxTypeInfoCheckCompatible = 0)
{
DWORD dwAuxTypeInfo;
int nPlotType = 0;
int nInListIndex = -1;
for(int ii = 0; ii < vnPlotTypes.GetSize(); ii++)
{
dwAuxTypeInfo = 0;
nPlotType = getPlotType(vnPlotTypes[ii], &dwAuxTypeInfo);
#ifdef _DEBUG_PLOT_TYPE
printf("PlotID(%d) -> %d %X, %X\n", vnPlotTypes[ii], nPlotType, dwAuxTypeInfo, (dwAuxTypeInfo & MASK_PCD_LAYER_BITS));
#endif
if(nInListIndex < 0 && isPlotTypesTheSame(nPlotTypeCheckCompatible, dwAuxTypeInfoCheckCompatible, nPlotType, dwAuxTypeInfo))
{
nInListIndex = ii;
continue;
}
DWORD dwThisLayerBitsTest;
DWORD dwAuxBitsTest;
if(!is_layer_type_compatible(m_dwLayerBits, dwAuxTypeInfo & MASK_PCD_LAYER_BITS, vnPlotTypes[ii]) ||
is_plot_type_incompatible(nPlotTypeCheckCompatible, dwAuxTypeInfoCheckCompatible, nPlotType, dwAuxTypeInfo))
{
vnPlotTypes.RemoveAt(ii);
ii--;
}
}
return nInListIndex;
}
DWORD getLayerBitsIgnoreExchange(DWORD dwLayerBits, bool bIgnorePolarSmith = true)
{
if(PCD_LAYER_EXCHANGE == dwLayerBits)
return 0;
if(bIgnorePolarSmith && dwLayerBits >= PCD_LAYER_POLAR && dwLayerBits <= PCD_LAYER_SMITH)
return 0;
return dwLayerBits;
}
bool is_layer_type_compatible(DWORD dwTargetLayerBits, DWORD dwPlotTypeBits, int nPlotType)
{
// PCD_LAYER_EXCHANGE is necessary to allow editing of scatter and other dataplots
// when X-Y are reversed (otherwise there is no match).
//-------- CPY 9/20/03 MATRIX_SEL_SEE_3D_PLOTS_IN_2D_LAYERS
//DWORD dwTarget = dwTargetLayerBits & ~PCD_LAYER_EXCHANGE;
//DWORD dwPlot = dwPlotTypeBits & ~PCD_LAYER_EXCHANGE;
//if(dwTarget >= PCD_LAYER_POLAR && dwTarget <= PCD_LAYER_SMITH) dwTarget = 0;// basic xy
//if(dwPlot >= PCD_LAYER_POLAR && dwPlot <= PCD_LAYER_SMITH) dwPlot = 0;// basic xy
DWORD dwTarget = getLayerBitsIgnoreExchange(dwTargetLayerBits);
DWORD dwPlot = getLayerBitsIgnoreExchange(dwPlotTypeBits);
//-------- MATRIX_SEL_SEE_3D_PLOTS_IN_2D_LAYERS
if (dwTarget != dwPlot)
return false;
// some layer has additional type that they don't support
if(PCD_LAYER_TRI == dwTargetLayerBits || PCD_LAYER_SMITH == dwTargetLayerBits)
{
if(IDM_PLOT_COLUMN == nPlotType)
return false;
if(PCD_LAYER_TRI == dwTargetLayerBits && IDM_PLOT_FLOWVECTOR == nPlotType)
return false;
}
return true;
}
bool is_plot_type_incompatible(int nPlotTypeTest, DWORD dwAuxTypeInfoTest, int nPlotType, DWORD dwAuxTypeInfo)
{
if( 0 == nPlotTypeTest )
return false;
if ( nPlotTypeTest == nPlotType )
{
if(isPlotTypesTheSame(nPlotTypeTest, dwAuxTypeInfoTest, nPlotType, dwAuxTypeInfo, true))
return false;
return true;// same bPlotType, but not the same dwAuxTypeInfo, must be incompatible
}
return compare_plot_types(nPlotTypeTest, nPlotType) == 0? true:false;
}
bool is_page_type_incompatible(int nPageTypeTest, int nPageType)
{
if( 0 == nPageTypeTest )
return false; // not specified is OK
if( EXIST_MATRIX == nPageTypeTest && nPageType != EXIST_MATRIX)
return true;
if( nPageTypeTest != EXIST_MATRIX && EXIST_MATRIX == nPageType )
return true;
return false;
}
private:
vector<uint> m_vnPlotTypes;
uint m_nSelPlotType;
DWORD m_dwAuxTypeInfo;
int m_nCustomPlotID;
int m_nCustomPlotExVal;
int m_nCustomPlotID_save;
int m_nCustomPlotExVal_save;
Control m_cntrlStyleHolder;
DWORD m_dwLayerBits;
int m_nCurrentDataPageType;
int m_nEditPlotPageType;
int m_nEditPlotType;
DWORD m_dwEditAuxTypeInfo;
bool m_bAvailDataReady;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -