本文整理汇总了C++中OGRStyleMgr::GetStyleString方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRStyleMgr::GetStyleString方法的具体用法?C++ OGRStyleMgr::GetStyleString怎么用?C++ OGRStyleMgr::GetStyleString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRStyleMgr
的用法示例。
在下文中一共展示了OGRStyleMgr::GetStyleString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kml2stylestring
void kml2stylestring (
StylePtr poKmlStyle,
OGRStyleMgr * poOgrSM )
{
OGRStyleMgr * poOgrNewSM ;
OGRStyleTool *poOgrST = NULL;
OGRStyleTool *poOgrTmpST = NULL;
int i;
poOgrNewSM = new OGRStyleMgr( NULL );
/***** linestyle / pen *****/
if ( poKmlStyle->has_linestyle ( ) ) {
poOgrNewSM->InitStyleString ( NULL );
LineStylePtr poKmlLineStyle = poKmlStyle->get_linestyle ( );
poOgrTmpST = NULL;
for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
poOgrST = poOgrSM->GetPart ( i, NULL );
if ( !poOgrST )
continue;
if ( poOgrST->GetType ( ) == OGRSTCPen ) {
poOgrTmpST = poOgrST;
}
else {
poOgrNewSM->AddPart ( poOgrST );
delete poOgrST;
}
}
OGRStylePen *poOgrStylePen = kml2pen ( poKmlLineStyle,
( OGRStylePen *) poOgrTmpST);
poOgrNewSM->AddPart ( poOgrStylePen );
delete poOgrStylePen;
poOgrSM->InitStyleString ( poOgrNewSM->GetStyleString(NULL) );
}
/***** polystyle / brush *****/
if ( poKmlStyle->has_polystyle ( ) ) {
poOgrNewSM->InitStyleString ( NULL );
PolyStylePtr poKmlPolyStyle = poKmlStyle->get_polystyle ( );
poOgrTmpST = NULL;
for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
poOgrST = poOgrSM->GetPart ( i, NULL );
if ( !poOgrST )
continue;
if ( poOgrST->GetType ( ) == OGRSTCBrush ) {
poOgrTmpST = poOgrST;
}
else {
poOgrNewSM->AddPart ( poOgrST );
delete poOgrST;
}
}
OGRStyleBrush *poOgrStyleBrush = kml2brush ( poKmlPolyStyle,
( OGRStyleBrush *) poOgrTmpST );
poOgrNewSM->AddPart ( poOgrStyleBrush );
delete poOgrStyleBrush;
poOgrSM->InitStyleString ( poOgrNewSM->GetStyleString(NULL) );
}
/***** iconstyle / symbol *****/
if ( poKmlStyle->has_iconstyle ( ) ) {
poOgrNewSM->InitStyleString ( NULL );
IconStylePtr poKmlIconStyle = poKmlStyle->get_iconstyle ( );
poOgrTmpST = NULL;
for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
poOgrST = poOgrSM->GetPart ( i, NULL );
if ( !poOgrST )
continue;
if ( poOgrST->GetType ( ) == OGRSTCSymbol ) {
poOgrTmpST = poOgrST;
}
else {
//.........这里部分代码省略.........
示例2: kml2featurestyle
//.........这里部分代码省略.........
/***** loop, read and copy to a string *****/
size_t nRead;
do {
nRead = VSIFReadL(szbuf, 1, sizeof(szbuf) - 1, fp);
if (nRead == 0)
break;
/***** copy buf to the string *****/
szbuf[nRead] = '\0';
oStyle.append( szbuf );
} while (!VSIFEofL(fp));
VSIFCloseL(fp);
/***** parse the kml into the ds style table *****/
if ( poOgrDS->ParseIntoStyleTable (&oStyle, pszUrlTmp)) {
kml2featurestyle (poKmlFeature,
poOgrDS,
poOgrLayer,
poOgrFeat );
}
else {
/***** if failed just store the url *****/
poOgrFeat->SetStyleString ( pszUrl );
}
}
CPLFree(pszUrlTmp);
}
else {
poOgrFeat->SetStyleString ( pszUrl );
}
}
}
CPLFree ( pszUrl );
}
/***** does the placemark have a style selector *****/
if ( poKmlFeature->has_styleselector ( ) ) {
StyleSelectorPtr poKmlStyleSelector =
poKmlFeature->get_styleselector ( );
/***** is the style a style? *****/
if ( poKmlStyleSelector->IsA ( kmldom::Type_Style ) ) {
StylePtr poKmlStyle = AsStyle ( poKmlStyleSelector );
OGRStyleMgr *poOgrSM = new OGRStyleMgr;
/***** if were resolving style the feature *****/
/***** might already have styling to add too *****/
const char *pszResolve = CPLGetConfigOption ( "LIBKML_RESOLVE_STYLE", "no" );
if (CPLTestBool(pszResolve)) {
poOgrSM->InitFromFeature ( poOgrFeat );
}
else {
/***** if featyurestyle gets a name tool this needs changed to the above *****/
poOgrSM->InitStyleString ( NULL );
}
/***** read the style *****/
kml2stylestring ( poKmlStyle, poOgrSM );
/***** add the style to the feature *****/
poOgrFeat->SetStyleString(poOgrSM->GetStyleString(NULL));
delete poOgrSM;
}
/***** is the style a stylemap? *****/
else if ( poKmlStyleSelector->IsA ( kmldom::Type_StyleMap ) ) {
/* todo need to figure out what to do with a style map */
}
}
}