本文整理汇总了C++中StylePtr::set_linestyle方法的典型用法代码示例。如果您正苦于以下问题:C++ StylePtr::set_linestyle方法的具体用法?C++ StylePtr::set_linestyle怎么用?C++ StylePtr::set_linestyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StylePtr
的用法示例。
在下文中一共展示了StylePtr::set_linestyle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: addstylestring2kml
//.........这里部分代码省略.........
{
GBool nullcheck;
GBool nullcheck2;
poKmlLabelStyle = poKmlFactory->CreateLabelStyle ( );
OGRStyleLabel *poStyleLabel = ( OGRStyleLabel * ) poOgrST;
/***** color *****/
int nR,
nG,
nB,
nA;
const char *pszcolor = poStyleLabel->ForeColor ( nullcheck );
if ( !nullcheck
&& poStyleLabel->GetRGBFromString ( pszcolor, nR, nG, nB, nA ) ) {
poKmlLabelStyle->set_color ( Color32 ( nA, nB, nG, nR ) );
}
/***** scale *****/
double dfScale = poStyleLabel->Stretch ( nullcheck );
if ( !nullcheck ) {
dfScale /= 100.0;
poKmlLabelStyle->set_scale ( dfScale );
}
/***** heading *****/
double heading = poStyleLabel->Angle ( nullcheck );
if ( !nullcheck ) {
if ( !poKmlIconStyle) {
poKmlIconStyle = poKmlFactory->CreateIconStyle ( );
IconStyleIconPtr poKmlIcon = poKmlFactory->CreateIconStyleIcon ( );
poKmlIconStyle->set_icon ( poKmlIcon );
}
poKmlIconStyle->set_heading ( heading );
}
/***** hotspot *****/
double dfDx = poStyleLabel->SpacingX ( nullcheck );
double dfDy = poStyleLabel->SpacingY ( nullcheck2 );
if ( !nullcheck && !nullcheck2 ) {
if ( !poKmlIconStyle) {
poKmlIconStyle = poKmlFactory->CreateIconStyle ( );
IconStyleIconPtr poKmlIcon = poKmlFactory->CreateIconStyleIcon ( );
poKmlIconStyle->set_icon ( poKmlIcon );
}
HotSpotPtr poKmlHotSpot = poKmlFactory->CreateHotSpot ( );
poKmlHotSpot->set_x ( dfDx );
poKmlHotSpot->set_y ( dfDy );
poKmlIconStyle->set_hotspot ( poKmlHotSpot );
}
/***** label text *****/
const char *pszText = poStyleLabel->TextString ( nullcheck );
if ( !nullcheck ) {
if ( poKmlPlacemark ) {
poKmlPlacemark->set_name( pszText );
}
}
break;
}
case OGRSTCNone:
default:
break;
}
delete poOgrST;
}
if ( poKmlLineStyle )
poKmlStyle->set_linestyle ( poKmlLineStyle );
if ( poKmlPolyStyle )
poKmlStyle->set_polystyle ( poKmlPolyStyle );
if ( poKmlIconStyle )
poKmlStyle->set_iconstyle ( poKmlIconStyle );
if ( poKmlLabelStyle )
poKmlStyle->set_labelstyle ( poKmlLabelStyle );
delete poOgrSM;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}