本文整理汇总了C++中StylePtr类的典型用法代码示例。如果您正苦于以下问题:C++ StylePtr类的具体用法?C++ StylePtr怎么用?C++ StylePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StylePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTimespanPlacemark
/**
* @brief KmlExport::createTimespanPlacemark Creates a timespan placemark, which allows the
* trajectory to be played forward in time. The placemark also contains pertinent data about
* the vehicle's state at that timespan
* @param timestampPoint
* @param lastPlacemarkTime
* @param newPlacemarkTime
* @return Returns the placemark containing the timespan
*/
PlacemarkPtr KmlExport::createTimespanPlacemark(const LLAVCoordinates ×tampPoint, quint32 lastPlacemarkTime, quint32 newPlacemarkTime)
{
// Create coordinates
CoordinatesPtr coordinates = factory->CreateCoordinates();
coordinates->add_latlngalt(timestampPoint.latitude, timestampPoint.longitude, timestampPoint.altitude);
// Create point, using previous coordinates
PointPtr point = factory->CreatePoint();
point->set_extrude(true); // Extrude to ground
point->set_altitudemode(kmldom::ALTITUDEMODE_ABSOLUTE);
point->set_coordinates(coordinates);
// Create the timespan
TimeSpanPtr timeSpan = factory->CreateTimeSpan();
QDateTime startTime = QDateTime::currentDateTimeUtc().addMSecs(lastPlacemarkTime); // FIXME: Make it a function of the realtime preferably gotten from the GPS
QDateTime endTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime);
timeSpan->set_begin(startTime.toString(dateTimeFormat).toStdString());
timeSpan->set_end(endTime.toString(dateTimeFormat).toStdString());
// Create an icon style. This arrow icon will be rotated and colored to represent velocity
AttitudeActual::DataFields attitudeActualData = attitudeActual->getData();
AirspeedActual::DataFields airspeedActualData = airspeedActual->getData();
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_color(mapVelocity2Color(airspeedActualData.CalibratedAirspeed));
iconStyle->set_heading(attitudeActualData.Yaw + 180); //Adding 180 degrees because the arrow art points down, i.e. south.
// Create a line style. This defines the style for the "legs" connecting the points to the ground.
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(mapVelocity2Color(timestampPoint.groundspeed));
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_linestyle(lineStyle);
style->set_iconstyle(iconStyle);
// Generate the placemark with all above attributes
PlacemarkPtr placemark = factory->CreatePlacemark();
placemark->set_geometry(point);
placemark->set_timeprimitive(timeSpan);
placemark->set_name(QString("%1").arg(timeStamp / 1000.0).toStdString());
placemark->set_visibility(true);
// Set the placemark to use the custom rotated arrow style
placemark->set_styleurl("#directiveArrowStyle");
placemark->set_styleselector(style);
// Add a nice description to the placemark
placemark->set_description(informationString.toStdString());
return placemark;
}
示例2: GetClass
void SchemeConfigParser::ResetClasses()
{
for(StylePtrMap::iterator i = m_LoadState.m_Classes.begin();
i != m_LoadState.m_Classes.end();
++i)
{
(*i).second->Reset();
}
// Also going to reset the default colours here:
m_LoadState.m_DefaultColours.Clear();
// Now re-set the default style:
StylePtr defcls = GetClass(_T("default"));
defcls->Combine(NULL, m_LoadState.m_Default);
}
示例3: createkmlliststyle
void createkmlliststyle (
KmlFactory * poKmlFactory,
const char* pszBaseName,
ContainerPtr poKmlLayerContainer,
DocumentPtr poKmlDocument,
const CPLString& osListStyleType,
const CPLString& osListStyleIconHref)
{
if( osListStyleType.size() || osListStyleIconHref.size() )
{
StylePtr poKmlStyle = poKmlFactory->CreateStyle ( );
const char* pszStyleName = CPLSPrintf("%s_liststyle", OGRLIBKMLGetSanitizedNCName(pszBaseName).c_str());
poKmlStyle->set_id ( pszStyleName );
ListStylePtr poKmlListStyle = poKmlFactory->CreateListStyle ( );
poKmlStyle->set_liststyle ( poKmlListStyle );
if( osListStyleType.size() )
{
if( EQUAL(osListStyleType, "check") )
poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECK );
else if( EQUAL(osListStyleType, "radioFolder") )
poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_RADIOFOLDER );
else if( EQUAL(osListStyleType, "checkOffOnly") )
poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECKOFFONLY );
else if( EQUAL(osListStyleType, "checkHideChildren") )
poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECKHIDECHILDREN );
else
{
CPLError(CE_Warning, CPLE_AppDefined,
"Invalid value for list style type: %s. Defaulting to Check",
osListStyleType.c_str());
poKmlListStyle->set_listitemtype( kmldom::LISTITEMTYPE_CHECK );
}
}
if( osListStyleIconHref.size() )
{
ItemIconPtr poItemIcon = poKmlFactory->CreateItemIcon ( );
poItemIcon->set_href( osListStyleIconHref.c_str() );
poKmlListStyle->add_itemicon(poItemIcon);
}
poKmlDocument->add_styleselector ( poKmlStyle );
poKmlLayerContainer->set_styleurl( CPLSPrintf("#%s", pszStyleName) );
}
}
示例4: onStyleGroup
void SchemeConfigParser::onStyleGroup(const XMLAttributes& att, const StylePtr& pClass)
{
PNASSERT(m_pCurrent != NULL);
LPCTSTR name = att.getValue(_T("name"));
if(name)
{
m_pCurrent->BeginStyleGroup(name, att.getValue(_T("description")), (pClass.get() ? pClass->Style->name.c_str() : NULL) );
}
}
示例5: getNodeDef
NodePtr NodeRegistry::createNode(const string& sType, const py::dict& pyDict)
{
const NodeDefinition& def = getNodeDef(sType);
py::dict effParams;
StylePtr pStyle;
if (pyDict.has_key("style")) {
py::object param = pyDict["style"];
pyDict.attr("__delitem__")("style");
pStyle = py::extract<StylePtr>(param);
effParams = pStyle->mergeParams(pyDict);
} else {
effParams = pyDict;
}
ArgList args(def.getDefaultArgs(), effParams);
NodeBuilder builder = def.getBuilder();
NodePtr pNode = builder(args);
pNode->setTypeInfo(&def);
pNode->setStyle(pStyle);
return pNode;
}
示例6: PNASSERT
void SchemeConfigParser::onStyle(const StylePtr& style, bool isBaseStyle)
{
PNASSERT(m_pCurrent != NULL);
if(isBaseStyle)
{
// Not already stored in the current one...
StylePtr p(new FullStyleDetails(*style.get()));
m_pCurrent->Styles.push_back(p);
}
}
示例7: styletable2kml
void styletable2kml (
OGRStyleTable * poOgrStyleTable,
KmlFactory * poKmlFactory,
ContainerPtr poKmlContainer )
{
/***** just return if the styletable is null *****/
if ( !poOgrStyleTable )
return;
/***** parse the style table *****/
poOgrStyleTable->ResetStyleStringReading ( );
const char *pszStyleString;
while ( ( pszStyleString = poOgrStyleTable->GetNextStyle ( ) ) ) {
const char *pszStyleName = poOgrStyleTable->GetLastStyleName ( );
/***** add the style header to the kml *****/
StylePtr poKmlStyle = poKmlFactory->CreateStyle ( );
poKmlStyle->set_id ( pszStyleName + 1 );
/***** parse the style string *****/
addstylestring2kml ( pszStyleString, poKmlStyle, poKmlFactory, NULL, NULL );
/***** add the style to the container *****/
DocumentPtr poKmlDocument = AsDocument ( poKmlContainer );
//ObjectPtr pokmlObject = boost::static_pointer_cast <kmldom::Object> () ;
//poKmlContainer->add_feature ( AsFeature( poKmlStyle) );
poKmlDocument->add_styleselector ( poKmlStyle );
}
return;
}
示例8: createGroundTrackStyle
/**
* @brief KmlExport::createGroundTrackStyle Creates a custom style for the ground track.
* @return Returns the custom style.
*/
StylePtr KmlExport::createGroundTrackStyle()
{
// Add custom balloon style (gets rid of "Directions to here...")
// https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
balloonStyle->set_text("$[id]");
// Create an icon style
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_scale(0);
// Create a label style
LabelStylePtr labelStyle = factory->CreateLabelStyle();
labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
labelStyle->set_scale(0);
// Create a line style
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(kmlbase::Color32(255, 0, 0, 0)); // Black
lineStyle->set_width(9);
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_iconstyle(iconStyle);
style->set_linestyle(lineStyle);
style->set_labelstyle(labelStyle);
style->set_id("ts_2_tb");
return style;
}
示例9: kml2styletable
void kml2styletable (
OGRStyleTable * poOgrStyleTable,
StylePtr poKmlStyle )
{
/***** no reason to add it if it don't have an id *****/
if ( poKmlStyle->has_id ( ) ) {
OGRStyleMgr *poOgrSM = new OGRStyleMgr ( poOgrStyleTable );
poOgrSM->InitStyleString ( NULL );
/***** read the style *****/
kml2stylestring ( poKmlStyle, poOgrSM );
/***** add the style to the style table *****/
const std::string oName = poKmlStyle->get_id ( );
poOgrSM->AddStyle ( CPLString ( ).Printf ( "@%s",
oName.c_str ( ) ), NULL );
/***** cleanup the style manager *****/
delete poOgrSM;
}
else {
CPLError ( CE_Failure, CPLE_AppDefined,
"ERROR Parseing kml Style: No id" );
}
return;
}
示例10: update_list
RenderContext::Manager::Manager(const css::PropertyList& plist)
: update_list(),
pushed_font_change_(false)
{
for(int n = 0; n != max_properties; ++n) {
const Property p = static_cast<Property>(n);
auto& stk = get_stack_array()[n];
const StylePtr style = plist.getProperty(p);
if(style == nullptr) {
// get default property
auto& pinfo = get_default_property_info(p);
// default properties that aren't inherited pushed, if they aren't the current default.
if(!pinfo.inherited) {
update_list.emplace_back(n);
get_stack_array()[n].emplace(pinfo.obj);
// XXX get_stack_array()[n]->calculateComputedValues();
if(is_font_property(p)) {
pushed_font_change_ = true;
}
}
} else if(!style->isInherited()) {
// Is the property isn't marked as being inherited, we handle it here.
if(style != get_stack_array()[n].top()) {
update_list.emplace_back(n);
get_stack_array()[n].emplace(style);
// XXX get_stack_array()[n]->calculateComputedValues();
if(is_font_property(p)) {
pushed_font_change_ = true;
}
}
}
}
// If font parameters changed that would cause a new font handle to be allocated we do it here
if(pushed_font_change_) {
get_font_handle_stack().emplace(get_font_handle());
}
}
示例11: createCustomBalloonStyle
/**
* @brief KmlExport::createCustomBalloonStyle Creates a custom balloon stye, using an arrow as an icon.
* @return Returns the custom balloon style.
*/
StyleMapPtr KmlExport::createCustomBalloonStyle()
{
StyleMapPtr styleMap = factory->CreateStyleMap();
{
// Add custom balloon style (gets rid of "Directions to here...")
// https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
balloonStyle->set_text("$[description]");
// Change the icon
IconStyleIconPtr iconStyleIcon = factory->CreateIconStyleIcon();
iconStyleIcon->set_href("http://maps.google.com/mapfiles/kml/shapes/arrow.png");
// Create a label style
LabelStylePtr labelStyle = factory->CreateLabelStyle();
labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
labelStyle->set_scale(0.75);
// Create an icon style
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_icon(iconStyleIcon);
iconStyle->set_scale(0.65);
// Create a line style
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_width(3.25);
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_iconstyle(iconStyle);
style->set_linestyle(lineStyle);
style->set_labelstyle(labelStyle);
PairPtr pair = factory->CreatePair();
pair->set_styleselector(style);
pair->set_key(kmldom::STYLESTATE_NORMAL);
styleMap->add_pair(pair);
}
{
// Add custom balloon style (gets rid of "Directions to here...")
// https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
balloonStyle->set_text("$[description]");
// Change the icon
IconStyleIconPtr iconStyleIcon = factory->CreateIconStyleIcon();
iconStyleIcon->set_href("http://maps.google.com/mapfiles/kml/shapes/arrow.png");
// Create an icon style
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_icon(iconStyleIcon);
iconStyle->set_scale(0.65);
// Create a label style
LabelStylePtr labelStyle = factory->CreateLabelStyle();
labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
labelStyle->set_scale(0.9);
// Create a line style
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_width(6.5);
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_iconstyle(iconStyle);
style->set_linestyle(lineStyle);
style->set_labelstyle(labelStyle);
PairPtr pair = factory->CreatePair();
pair->set_styleselector(style);
pair->set_key(kmldom::STYLESTATE_HIGHLIGHT);
styleMap->add_pair(pair);
}
styleMap->set_id("directiveArrowStyle");
return styleMap;
}
示例12: createWallAxesStyle
StyleMapPtr KmlExport::createWallAxesStyle()
{
StyleMapPtr styleMap = factory->CreateStyleMap();
{
// Add custom balloon style (gets rid of "Directions to here...")
// https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
balloonStyle->set_text("$[id]");
// Create an icon style
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_scale(0);
// Create a label style
LabelStylePtr labelStyle = factory->CreateLabelStyle();
labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
labelStyle->set_scale(0);
// Create a line style
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(kmlbase::Color32(255, 0, 0, 0)); // Black
lineStyle->set_width(.9);
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_iconstyle(iconStyle);
style->set_linestyle(lineStyle);
style->set_labelstyle(labelStyle);
PairPtr pair = factory->CreatePair();
pair->set_styleselector(style);
pair->set_key(kmldom::STYLESTATE_NORMAL);
styleMap->add_pair(pair);
}
{
// Add custom balloon style (gets rid of "Directions to here...")
// https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
balloonStyle->set_text("$[id]");
// Create an icon style
IconStylePtr iconStyle = factory->CreateIconStyle();
iconStyle->set_scale(0);
// Create a label style
LabelStylePtr labelStyle = factory->CreateLabelStyle();
labelStyle->set_color(kmlbase::Color32(255, 0, 255, 255));
labelStyle->set_scale(0.75);
// Create a line style
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(kmlbase::Color32(255, 0, 0, 0)); // Black
lineStyle->set_width(1.8);
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_iconstyle(iconStyle);
style->set_linestyle(lineStyle);
style->set_labelstyle(labelStyle);
PairPtr pair = factory->CreatePair();
pair->set_styleselector(style);
pair->set_key(kmldom::STYLESTATE_HIGHLIGHT);
styleMap->add_pair(pair);
}
styleMap->set_id("ts_1_tb");
return styleMap;
}
示例13: CreateLineStringPlacemark
/**
* @brief KmlExport::CreateLineStringPlacemark Adds a line segment which is colored according to the
* vehicle's speed.
* @param startPoint Beginning point along line
* @param endPoint End point point along line
* @return Returns the placemark containing the line segment
*/
PlacemarkPtr KmlExport::CreateLineStringPlacemark(const LLAVCoordinates &startPoint, const LLAVCoordinates &endPoint, quint32 newPlacemarkTime)
{
CoordinatesPtr coordinates = factory->CreateCoordinates();
coordinates->add_latlngalt(startPoint.latitude, startPoint.longitude, startPoint.altitude);
coordinates->add_latlngalt(endPoint.latitude, endPoint.longitude, endPoint.altitude);
LineStringPtr linestring = factory->CreateLineString();
linestring->set_extrude(true); // Extrude to ground
linestring->set_altitudemode(kmldom::ALTITUDEMODE_ABSOLUTE);
linestring->set_coordinates(coordinates);
StyleMapPtr styleMap = factory->CreateStyleMap();
// Add custom balloon style (gets rid of "Directions to here...")
// https://groups.google.com/forum/?fromgroups#!topic/kml-support-getting-started/2CqF9oiynRY
BalloonStylePtr balloonStyle = factory->CreateBalloonStyle();
balloonStyle->set_text("$[description]");
{
double currentVelocity = (startPoint.groundspeed + endPoint.groundspeed)/2;
// Set the linestyle. The color is a function of speed.
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(mapVelocity2Color(currentVelocity));
PolyStylePtr polyStyle = factory->CreatePolyStyle();
polyStyle->set_color(mapVelocity2Color(currentVelocity, 100));
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_linestyle(lineStyle);
style->set_polystyle(polyStyle);
PairPtr pair = factory->CreatePair();
pair->set_styleselector(style);
pair->set_key(kmldom::STYLESTATE_NORMAL);
styleMap->add_pair(pair);
}
{
double currentVelocity = (startPoint.groundspeed + endPoint.groundspeed)/2;
// Set the linestyle. The color is a function of speed.
LineStylePtr lineStyle = factory->CreateLineStyle();
lineStyle->set_color(mapVelocity2Color(currentVelocity));
PolyStylePtr polyStyle = factory->CreatePolyStyle();
polyStyle->set_color(mapVelocity2Color(currentVelocity, 100));
polyStyle->set_fill(false);
// Link the style to the icon
StylePtr style = factory->CreateStyle();
style->set_balloonstyle(balloonStyle);
style->set_linestyle(lineStyle);
style->set_polystyle(polyStyle);
PairPtr pair = factory->CreatePair();
pair->set_styleselector(style);
pair->set_key(kmldom::STYLESTATE_HIGHLIGHT);
styleMap->add_pair(pair);
}
PlacemarkPtr placemark = factory->CreatePlacemark();
placemark->set_geometry(linestring);
placemark->set_styleselector(styleMap);
placemark->set_visibility(true);
// Create the timespan
TimeSpanPtr timeSpan = factory->CreateTimeSpan();
QDateTime startTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime); // FIXME: Make this a function of the true time, preferably gotten from the GPS
QDateTime endTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime);
timeSpan->set_begin(startTime.toString(dateTimeFormat).toStdString());
timeSpan->set_end(endTime.toString(dateTimeFormat).toStdString());
// Set the name
QDateTime trackTime = QDateTime::currentDateTimeUtc().addMSecs(newPlacemarkTime); // FIXME: Make it a function of the realtime preferably gotten from the GPS
placemark->set_name(trackTime.toString(dateTimeFormat).toStdString());
// Add a nice description to the track placemark
placemark->set_description(informationString.toStdString());
// Set the timespan
placemark->set_timeprimitive(timeSpan);
return placemark;
}
示例14: addstylestring2kml
void addstylestring2kml (
const char *pszStyleString,
StylePtr poKmlStyle,
KmlFactory * poKmlFactory,
PlacemarkPtr poKmlPlacemark,
OGRFeature * poOgrFeat )
{
LineStylePtr poKmlLineStyle = NULL;
PolyStylePtr poKmlPolyStyle = NULL;
IconStylePtr poKmlIconStyle = NULL;
LabelStylePtr poKmlLabelStyle = NULL;
/***** just bail now if stylestring is empty *****/
if ( !pszStyleString || !*pszStyleString ) {
return;
}
/***** create and init a style mamager with the style string *****/
OGRStyleMgr *poOgrSM = new OGRStyleMgr;
poOgrSM->InitStyleString ( pszStyleString );
/***** loop though the style parts *****/
int i;
for ( i = 0; i < poOgrSM->GetPartCount ( NULL ); i++ ) {
OGRStyleTool *poOgrST = poOgrSM->GetPart ( i, NULL );
if ( !poOgrST ) {
continue;
}
switch ( poOgrST->GetType ( ) ) {
case OGRSTCPen:
{
GBool nullcheck;
poKmlLineStyle = poKmlFactory->CreateLineStyle ( );
OGRStylePen *poStylePen = ( OGRStylePen * ) poOgrST;
/***** pen color *****/
int nR,
nG,
nB,
nA;
const char *pszcolor = poStylePen->Color ( nullcheck );
if ( !nullcheck
&& poStylePen->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
poKmlLineStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
}
double dfWidth = poStylePen->Width ( nullcheck );
if ( nullcheck )
dfWidth = 1.0;
poKmlLineStyle->set_width ( dfWidth );
break;
}
case OGRSTCBrush:
{
GBool nullcheck;
poKmlPolyStyle = poKmlFactory->CreatePolyStyle ( );
OGRStyleBrush *poStyleBrush = ( OGRStyleBrush * ) poOgrST;
/***** brush color *****/
int nR,
nG,
nB,
nA;
const char *pszcolor = poStyleBrush->ForeColor ( nullcheck );
if ( !nullcheck
&& poStyleBrush->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
poKmlPolyStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
}
break;
}
case OGRSTCSymbol:
{
GBool nullcheck;
GBool nullcheck2;
OGRStyleSymbol *poStyleSymbol = ( OGRStyleSymbol * ) poOgrST;
/***** id (kml icon) *****/
//.........这里部分代码省略.........
示例15: 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 {
//.........这里部分代码省略.........