?? ogrfeaturestyle.cpp
字號:
case OGRSTypeBoolean:
sStyleValue.nValue = atoi(pszParamString);
break;
default:
sStyleValue.bValid = FALSE;
break;
}
}
/****************************************************************************/
/* void OGRStyleTool::SetParamNum(OGRStyleParamId &sStyleParam , */
/* OGRStyleValue &sStyleValue, */
/* int nParam) */
/* */
/****************************************************************************/
void OGRStyleTool::SetParamNum(OGRStyleParamId &sStyleParam ,
OGRStyleValue &sStyleValue,
int nParam)
{
Parse();
StyleModified();
sStyleValue.bValid = TRUE;
sStyleValue.eUnit = GetUnit();
switch (sStyleParam.eType)
{
// if sStyleParam.bGeoref == TRUE , need to convert to output value;
case OGRSTypeString:
sStyleValue.pszValue = CPLStrdup(CPLSPrintf("%d",nParam));
break;
case OGRSTypeDouble:
sStyleValue.dfValue = (double)nParam;
break;
case OGRSTypeInteger:
case OGRSTypeBoolean:
sStyleValue.nValue = nParam;
break;
default:
sStyleValue.bValid = FALSE;
break;
}
}
/****************************************************************************/
/* void OGRStyleTool::SetParamDbl(OGRStyleParamId &sStyleParam , */
/* OGRStyleValue &sStyleValue, */
/* double dfParam) */
/* */
/****************************************************************************/
void OGRStyleTool::SetParamDbl(OGRStyleParamId &sStyleParam ,
OGRStyleValue &sStyleValue,
double dfParam)
{
Parse();
StyleModified();
sStyleValue.bValid = TRUE;
sStyleValue.eUnit = GetUnit();
switch (sStyleParam.eType)
{
// if sStyleParam.bGeoref == TRUE , need to convert to output value;
case OGRSTypeString:
sStyleValue.pszValue = CPLStrdup(CPLSPrintf("%f",dfParam));
break;
case OGRSTypeDouble:
sStyleValue.dfValue = dfParam;
break;
case OGRSTypeInteger:
case OGRSTypeBoolean:
sStyleValue.nValue = (int)dfParam;
break;
default:
sStyleValue.bValid = FALSE;
break;
}
}
/* ======================================================================== */
/* OGRStylePen */
/* Specific parameter (Set/Get) for the StylePen */
/* ======================================================================== */
/****************************************************************************/
/* OGRStylePen::OGRStylePen() */
/* */
/****************************************************************************/
OGRStylePen::OGRStylePen() : OGRStyleTool(OGRSTCPen)
{
m_pasStyleValue = (OGRStyleValue *)CPLCalloc(OGRSTPenLast,
sizeof(OGRStyleValue));
}
/****************************************************************************/
/* OGRStylePen::~OGRStylePen() */
/* */
/****************************************************************************/
OGRStylePen::~OGRStylePen()
{
for (int i = 0; i < OGRSTPenLast; i++)
{
if (m_pasStyleValue[i].pszValue != NULL)
{
CPLFree(m_pasStyleValue[i].pszValue);
m_pasStyleValue[i].pszValue = NULL;
}
}
CPLFree(m_pasStyleValue);
}
/************************************************************************/
/* OGRStylePen::Parse() */
/************************************************************************/
GBool OGRStylePen::Parse()
{
return OGRStyleTool::Parse(asStylePen,m_pasStyleValue,(int)OGRSTPenLast);
}
/************************************************************************/
/* GetParamStr() */
/************************************************************************/
const char *OGRStylePen::GetParamStr(OGRSTPenParam eParam, GBool &bValueIsNull)
{
return OGRStyleTool::GetParamStr(asStylePen[eParam],
m_pasStyleValue[eParam],
bValueIsNull);
}
/************************************************************************/
/* GetParamNum() */
/************************************************************************/
int OGRStylePen::GetParamNum(OGRSTPenParam eParam,GBool &bValueIsNull)
{
return OGRStyleTool::GetParamNum(asStylePen[eParam],
m_pasStyleValue[eParam],bValueIsNull);
}
/************************************************************************/
/* GetParamDbl() */
/************************************************************************/
double OGRStylePen::GetParamDbl(OGRSTPenParam eParam,GBool &bValueIsNull)
{
return OGRStyleTool::GetParamDbl(asStylePen[eParam],
m_pasStyleValue[eParam],bValueIsNull);
}
/************************************************************************/
/* SetParamStr() */
/************************************************************************/
void OGRStylePen::SetParamStr(OGRSTPenParam eParam, const char *pszParamString)
{
OGRStyleTool::SetParamStr(asStylePen[eParam],m_pasStyleValue[eParam],
pszParamString);
}
/************************************************************************/
/* SetParamNum() */
/************************************************************************/
void OGRStylePen::SetParamNum(OGRSTPenParam eParam, int nParam)
{
OGRStyleTool::SetParamNum(asStylePen[eParam],
m_pasStyleValue[eParam],nParam);
}
/************************************************************************/
/* SetParamDbl() */
/************************************************************************/
void OGRStylePen::SetParamDbl(OGRSTPenParam eParam, double dfParam)
{
OGRStyleTool::SetParamDbl(asStylePen[eParam],
m_pasStyleValue[eParam],dfParam);
}
/************************************************************************/
/* GetStyleString() */
/************************************************************************/
const char *OGRStylePen::GetStyleString()
{
return OGRStyleTool::GetStyleString(asStylePen,m_pasStyleValue,
(int)OGRSTPenLast);
}
/****************************************************************************/
/* OGRStyleBrush::OGRStyleBrush() */
/* */
/****************************************************************************/
OGRStyleBrush::OGRStyleBrush() : OGRStyleTool(OGRSTCBrush)
{
m_pasStyleValue = (OGRStyleValue *)CPLCalloc(OGRSTBrushLast,
sizeof(OGRStyleValue));
}
/****************************************************************************/
/* OGRStyleBrush::~OGRStyleBrush() */
/* */
/****************************************************************************/
OGRStyleBrush::~OGRStyleBrush()
{
for (int i = 0; i < OGRSTBrushLast; i++)
{
if (m_pasStyleValue[i].pszValue != NULL)
{
CPLFree(m_pasStyleValue[i].pszValue);
m_pasStyleValue[i].pszValue = NULL;
}
}
CPLFree(m_pasStyleValue);
}
/************************************************************************/
/* Parse() */
/************************************************************************/
GBool OGRStyleBrush::Parse()
{
return OGRStyleTool::Parse(asStyleBrush,m_pasStyleValue,
(int)OGRSTBrushLast);
}
/************************************************************************/
/* GetParamStr() */
/************************************************************************/
const char *OGRStyleBrush::GetParamStr(OGRSTBrushParam eParam, GBool &bValueIsNull)
{
return OGRStyleTool::GetParamStr(asStyleBrush[eParam],
m_pasStyleValue[eParam],
bValueIsNull);
}
/************************************************************************/
/* GetParamNum() */
/************************************************************************/
int OGRStyleBrush::GetParamNum(OGRSTBrushParam eParam,GBool &bValueIsNull)
{
return OGRStyleTool::GetParamNum(asStyleBrush[eParam],
m_pasStyleValue[eParam],bValueIsNull);
}
/************************************************************************/
/* GetParamDbl() */
/************************************************************************/
double OGRStyleBrush::GetParamDbl(OGRSTBrushParam eParam,GBool &bValueIsNull)
{
return OGRStyleTool::GetParamDbl(asStyleBrush[eParam],
m_pasStyleValue[eParam],bValueIsNull);
}
/************************************************************************/
/* SetParamStr() */
/************************************************************************/
void OGRStyleBrush::SetParamStr(OGRSTBrushParam eParam, const char *pszParamString)
{
OGRStyleTool::SetParamStr(asStyleBrush[eParam],m_pasStyleValue[eParam],
pszParamString);
}
/************************************************************************/
/* SetParamNum() */
/************************************************************************/
void OGRStyleBrush::SetParamNum(OGRSTBrushParam eParam, int nParam)
{
OGRStyleTool::SetParamNum(asStyleBrush[eParam],
m_pasStyleValue[eParam],nParam);
}
/************************************************************************/
/* SetParamDbl() */
/************************************************************************/
void OGRStyleBrush::SetParamDbl(OGRSTBrushParam eParam, double dfParam)
{
OGRStyleTool::SetParamDbl(asStyleBrush[eParam],
m_pasStyleValue[eParam],dfParam);
}
/************************************************************************/
/* GetStyleString() */
/************************************************************************/
const char *OGRStyleBrush::GetStyleString()
{
return OGRStyleTool::GetStyleString(asStyleBrush,m_pasStyleValue,
(int)OGRSTBrushLast);
}
/****************************************************************************/
/* OGRStyleSymbol::OGRStyleSymbol() */
/****************************************************************************/
OGRStyleSymbol::OGRStyleSymbol() : OGRStyleTool(OGRSTCSymbol)
{
m_pasStyleValue = (OGRStyleValue *)CPLCalloc(OGRSTSymbolLast,
sizeof(OGRStyleValue));
}
/****************************************************************************/
/* OGRStyleSymbol::~OGRStyleSymbol() */
/* */
/****************************************************************************/
OGRStyleSymbol::~OGRStyleSymbol()
{
for (int i = 0; i < OGRSTSymbolLast; i++)
{
if (m_pasStyleValue[i].pszValue != NULL)
{
CPLFree(m_pasStyleValue[i].pszValue);
m_pasStyleValue[i].pszValue = NULL;
}
}
CPLFree(m_pasStyleValue);
}
/************************************************************************/
/* Parse() */
/************************************************************************/
GBool OGRStyleSymbol::Parse()
{
return OGRStyleTool::Parse(asStyleSymbol,m_pasStyleValue,
(int)OGRSTSymbolLast);
}
/************************************************************************/
/* GetParamStr() */
/************************************************************************/
const char *OGRStyleSymbol::GetParamStr(OGRSTSymbolParam eParam, GBool &bValueIsNull)
{ return OGRStyleTool::GetParamStr(asStyleSymbol[eParam],
m_pasStyleValue[eParam],
bValueIsNull);
}
/************************************************************************/
/* GetParamNum()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -