当前位置: 首页>>代码示例>>C++>>正文


C++ GeoWriter::writeOptionalElement方法代码示例

本文整理汇总了C++中GeoWriter::writeOptionalElement方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoWriter::writeOptionalElement方法的具体用法?C++ GeoWriter::writeOptionalElement怎么用?C++ GeoWriter::writeOptionalElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeoWriter的用法示例。


在下文中一共展示了GeoWriter::writeOptionalElement方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

bool KmlLookAtTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataLookAt *lookAt = static_cast<const GeoDataLookAt*>(node);

    writer.writeStartElement( kml::kmlTag_LookAt );
    KmlObjectTagWriter::writeIdentifiers( writer, lookAt );

    if (lookAt->timeStamp().when().isValid()) {
        writer.writeStartElement("gx:TimeStamp");
        writer.writeElement("when", lookAt->timeStamp().when().toString(Qt::ISODate));
        writer.writeEndElement();
    }

    if( lookAt->timeSpan().isValid() ){
        writer.writeStartElement("gx:TimeSpan");
        if (lookAt->timeSpan().begin().when().isValid())
            writer.writeElement("begin", lookAt->timeSpan().begin().when().toString(Qt::ISODate));
        if (lookAt->timeSpan().end().when().isValid())
            writer.writeElement("end", lookAt->timeSpan().end().when().toString(Qt::ISODate));
        writer.writeEndElement();
    }

    writer.writeOptionalElement( "longitude", QString::number( lookAt->longitude( GeoDataCoordinates::Degree ), 'f', 10 ) );
    writer.writeOptionalElement( "latitude", QString::number( lookAt->latitude( GeoDataCoordinates::Degree ), 'f', 10 ) );
    writer.writeOptionalElement( "altitude", QString::number( lookAt->altitude(), 'f', 10 ) );
    writer.writeOptionalElement( "range", QString::number( lookAt->range(), 'f', 10 ) );
    KmlGroundOverlayWriter::writeAltitudeMode( writer, lookAt->altitudeMode() );

    writer.writeEndElement();

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:33,代码来源:KmlLookAtTagWriter.cpp

示例2: write

bool KmlLinkTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataLink *link = static_cast<const GeoDataLink*>( node );

    writer.writeStartElement( kml::kmlTag_Link );
    KmlObjectTagWriter::writeIdentifiers( writer, link );

    writer.writeElement( kml::kmlTag_href, link->href() );

    QString const refreshMode = refreshModeToString( link->refreshMode() );
    writer.writeOptionalElement( kml::kmlTag_refreshMode, refreshMode, "onChange" );

    writer.writeElement( kml::kmlTag_refreshInterval, QString::number( link->refreshInterval() ) );

    QString const viewRefreshMode = viewRefreshModeToString( link->viewRefreshMode() );
    writer.writeOptionalElement( kml::kmlTag_viewRefreshMode, viewRefreshMode, "never" );

    writer.writeElement( kml::kmlTag_viewRefreshTime, QString::number( link->viewRefreshTime() ) );

    writer.writeElement( kml::kmlTag_viewBoundScale, QString::number( link->viewBoundScale() ) );

    writer.writeOptionalElement( kml::kmlTag_viewFormat, link->viewFormat());

    writer.writeOptionalElement( kml::kmlTag_httpQuery, link->httpQuery());

    writer.writeEndElement();

    return true;
}
开发者ID:KDE,项目名称:marble,代码行数:29,代码来源:KmlLinkTagWriter.cpp

示例3: write

bool KmlPolygonTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataPolygon *polygon = static_cast<const GeoDataPolygon*>( node );

    writer.writeStartElement( kml::kmlTag_Polygon );
    KmlObjectTagWriter::writeIdentifiers( writer, polygon );
    writer.writeOptionalElement( kml::kmlTag_extrude, QString::number( polygon->extrude() ), "0" );

    writer.writeStartElement( "outerBoundaryIs" );
    writeElement( &polygon->outerBoundary(), writer );
    writer.writeEndElement();

    const QVector<GeoDataLinearRing>& linearRings = polygon->innerBoundaries();
    if (linearRings.size() > 0) {
	writer.writeStartElement( "innerBoundaryIs" );
	for ( int i = 0; i < linearRings.size(); ++i ) {
	    const GeoDataLinearRing& ring = linearRings[i];
	    writeElement( &ring, writer );
	}
	writer.writeEndElement();
    }

    writer.writeEndElement();

    return true;

}
开发者ID:PayalPradhan,项目名称:marble,代码行数:27,代码来源:KmlPolygonTagWriter.cpp

示例4: writeMid

bool KmlPhotoOverlayWriter::writeMid( const GeoNode *node, GeoWriter &writer ) const
{
    KmlOverlayTagWriter::writeMid( node, writer );

    const GeoDataPhotoOverlay *photo_overlay =
        static_cast<const GeoDataPhotoOverlay*>( node );

    // rotation
    QString const rotation = QString::number( photo_overlay->rotation(), 'f', 3 );
    writer.writeOptionalElement( kml::kmlTag_rotation, rotation, "0.000" );

    // ViewVolume
    writer.writeStartElement( kml::kmlTag_ViewVolume );
    writer.writeOptionalElement<qreal>( kml::kmlTag_leftFov, photo_overlay->viewVolume().leftFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_rightFov, photo_overlay->viewVolume().rightFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_bottomFov, photo_overlay->viewVolume().bottomFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_topFov, photo_overlay->viewVolume().topFov(), 0 );
    writer.writeOptionalElement<qreal>( kml::kmlTag_near, photo_overlay->viewVolume().near(), 0 );
    writer.writeEndElement();

    // ImagePyramid
    writer.writeStartElement( kml::kmlTag_ImagePyramid );
    writer.writeOptionalElement<int>( kml::kmlTag_tileSize, photo_overlay->imagePyramid().tileSize(), 256 );
    writer.writeOptionalElement<int>( kml::kmlTag_maxWidth, photo_overlay->imagePyramid().maxWidth() );
    writer.writeOptionalElement<int>( kml::kmlTag_maxHeight, photo_overlay->imagePyramid().maxHeight() );

    switch ( photo_overlay->imagePyramid().gridOrigin() )
    {
    case GeoDataImagePyramid::LowerLeft:
        writer.writeElement( kml::kmlTag_gridOrigin, "lowerLeft" );
        break;
    case GeoDataImagePyramid::UpperLeft:
        writer.writeElement( kml::kmlTag_gridOrigin, "upperLeft" );
        break;
    }
    writer.writeEndElement();

    // Point
    writeElement( &photo_overlay->point(), writer );

    // shape
    switch ( photo_overlay->shape() )
    {
    case GeoDataPhotoOverlay::Rectangle:
        break;
    case GeoDataPhotoOverlay::Cylinder:
        writer.writeElement( kml::kmlTag_shape, "cylinder" );
        break;
    case GeoDataPhotoOverlay::Sphere:
        writer.writeElement( kml::kmlTag_shape, "sphere" );
        break;
    }

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:55,代码来源:KmlPhotoOverlayWriter.cpp

示例5: write

bool KmlNetworkLinkTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
{

    const GeoDataNetworkLink *networkLink = static_cast<const GeoDataNetworkLink*>( node );

    writer.writeStartElement( kml::kmlTag_NetworkLink );

    writer.writeOptionalElement( kml::kmlTag_name, networkLink->name() );

    writer.writeOptionalElement( kml::kmlTag_visibility, QString::number( networkLink->isVisible() ), "1");

    writer.writeOptionalElement( kml::kmlTag_refreshVisibility, QString::number( networkLink->refreshVisibility() ), "0" );

    writer.writeOptionalElement( kml::kmlTag_flyToView, QString::number( networkLink->flyToView() ), "0" );

    writeElement( &networkLink->link(), writer);

    writer.writeEndElement();

    return true;
}
开发者ID:KDE,项目名称:marble,代码行数:21,代码来源:KmlNetworkLinkTagWriter.cpp

示例6: write

bool KmlPlacemarkTagWriter::write( const GeoNode *node,
                                   GeoWriter& writer ) const
{
    const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark*>(node);
    writer.writeStartElement( kml::kmlTag_Placemark );

    writer.writeOptionalElement( "name", placemark->name() );
    writer.writeElement( kml::kmlTag_visibility, QString::number( placemark->isVisible() ) );
    writer.writeOptionalElement( kml::kmlTag_styleUrl, placemark->styleUrl() );

    if( !placemark->description().isEmpty() ) {
        writer.writeStartElement( "description" );
        if( placemark->descriptionIsCDATA() ) {
            writer.writeCDATA( placemark->description() );
        } else {
            writer.writeCharacters( placemark->description() );
        }
        writer.writeEndElement();
    }


    if( !placemark->extendedData().isEmpty() ){
        writeElement( &placemark->extendedData(), writer );
    }

    if( placemark->geometry() ) {
        writeElement( placemark->geometry(), writer );
    }

    if( placemark->lookAt() ){
        writeElement( placemark->lookAt(), writer );
    }

    if( placemark->timeStamp().when().isValid() )
        writeElement( &placemark->timeStamp(), writer );

    writer.writeEndElement();
    return true;
}
开发者ID:AsherBond,项目名称:marble,代码行数:39,代码来源:KmlPlacemarkTagWriter.cpp

示例7: write

bool KmlDataTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataData *data = static_cast<const GeoDataData*>( node );

    writer.writeStartElement( kml::kmlTag_Data );
    writer.writeAttribute( "name", data->name() );
    writer.writeOptionalElement( kml::kmlTag_displayName, data->displayName() );
    writer.writeElement( "value", data->value().toString() );
    writer.writeEndElement();

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:13,代码来源:KmlDataTagWriter.cpp

示例8: write

bool KmlColorStyleTagWriter::write( const Marble::GeoNode *node, GeoWriter &writer ) const
{
    GeoDataColorStyle const *colorStyle = static_cast<const GeoDataColorStyle*>(node);

    if ( colorStyle->id().isEmpty() &&
            colorStyle->targetId().isEmpty() &&
            colorStyle->color() == defaultColor() &&
            colorStyle->colorMode() == GeoDataColorStyle::Normal &&
            isEmpty( node ) ) {
        return true;
    }

    writer.writeStartElement( m_elementName );

    KmlObjectTagWriter::writeIdentifiers( writer, colorStyle);
    writer.writeOptionalElement( kml::kmlTag_color, formatColor( colorStyle->color() ), formatColor( defaultColor() ) );
    QString const colorMode = colorStyle->colorMode() == GeoDataColorStyle::Random ? "random" : "normal";
    writer.writeOptionalElement( kml::kmlTag_colorMode, colorMode, "normal" );

    bool const result = writeMid( node, writer );
    writer.writeEndElement();
    return result;
}
开发者ID:KDE,项目名称:marble,代码行数:23,代码来源:KmlColorStyleTagWriter.cpp

示例9: write

bool KmlBalloonStyleTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataBalloonStyle *balloonStyle = static_cast<const GeoDataBalloonStyle*>( node );
    bool const isEmpty = balloonStyle->backgroundColor() == QColor( Qt::white ) &&
            balloonStyle->textColor() == QColor( Qt::black ) &&
            balloonStyle->text().isEmpty() &&
            balloonStyle->displayMode() == GeoDataBalloonStyle::Default;
    if ( isEmpty ) {
            return true;
    }

    writer.writeStartElement( kml::kmlTag_BalloonStyle );
    KmlObjectTagWriter::writeIdentifiers( writer, balloonStyle );

    QString const backgroundColor = KmlColorStyleTagWriter::formatColor( balloonStyle->backgroundColor() );
    writer.writeOptionalElement( kml::kmlTag_bgColor, backgroundColor, "ffffffff" );
    QString const textColor = KmlColorStyleTagWriter::formatColor( balloonStyle->textColor() );
    writer.writeOptionalElement( kml::kmlTag_textColor, textColor, "ff000000" );

    QString const textString = balloonStyle->text();
    if ( textString.contains( QRegExp( "[<>&]" ) ) ) {
        writer.writeStartElement( kml::kmlTag_text );
        writer.writeCDATA( textString );
        writer.writeEndElement();
    } else {
        writer.writeOptionalElement( kml::kmlTag_text, textString );
    }

    if ( balloonStyle->displayMode() == GeoDataBalloonStyle::Hide ) {
        writer.writeElement( kml::kmlTag_displayMode, "hide" );
    }

    writer.writeEndElement();
    return true;
}
开发者ID:calincru,项目名称:marble,代码行数:36,代码来源:KmlBalloonStyleTagWriter.cpp

示例10: writeMid

bool KmlGroundOverlayWriter::writeMid(const GeoNode *node, GeoWriter &writer) const
{
    KmlOverlayTagWriter::writeMid( node, writer );

    const GeoDataGroundOverlay *ground_overlay =
        static_cast<const GeoDataGroundOverlay*>( node );

    writer.writeOptionalElement( kml::kmlTag_altitude,
                                 QString::number(ground_overlay->altitude()), "0" );
    KmlGroundOverlayWriter::writeAltitudeMode( writer, ground_overlay->altitudeMode() );

    if ( !ground_overlay->latLonBox().isEmpty() ) {
        writeElement( &ground_overlay->latLonBox(), writer );
    }

    if ( ground_overlay->latLonQuad().isValid() ) {
        writeElement( &ground_overlay->latLonQuad(), writer );
    }

    return true;
}
开发者ID:KDE,项目名称:marble,代码行数:21,代码来源:KmlGroundOverlayWriter.cpp

示例11: writeMid

bool KmlPlacemarkTagWriter::writeMid( const GeoNode *node, GeoWriter& writer ) const
{
    const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark*>(node);

    writer.writeOptionalElement( kml::kmlTag_styleUrl, placemark->styleUrl() );
    if ( placemark->styleUrl().isEmpty() && placemark->customStyle() ) {
        writeElement( placemark->customStyle().data(), writer );
    }

    if( placemark->geometry() ) {
        writeElement( placemark->geometry(), writer );
    }

    if( placemark->isBalloonVisible() ){
        QString string;
        string.setNum( 1 );
        writer.writeElement( kml::kmlTag_nameSpaceGx22, kml::kmlTag_balloonVisibility, string );
    }

    return true;
}
开发者ID:PayalPradhan,项目名称:marble,代码行数:21,代码来源:KmlPlacemarkTagWriter.cpp

示例12: write

bool KmlPointTagWriter::write( const GeoNode *node,
                               GeoWriter& writer ) const
{
    const GeoDataPoint *point = static_cast<const GeoDataPoint*>(node);

    if ( !point->coordinates().isValid() ) {
        return true;
    }

    writer.writeStartElement( kml::kmlTag_Point );
    KmlObjectTagWriter::writeIdentifiers( writer, point );
    writer.writeOptionalElement( kml::kmlTag_extrude, QString::number( point->extrude() ), "0" );
    writer.writeStartElement("coordinates");

    QString coordinateString;

    //FIXME: this should be using the GeoDataCoordinates::toString but currently
    // it is not including the altitude and is adding an extra space after commas

    coordinateString += QString::number( point->coordinates().longitude( GeoDataCoordinates::Degree ), 'f', 10 );
    coordinateString += ',' ;
    coordinateString += QString::number( point->coordinates().latitude( GeoDataCoordinates::Degree ) , 'f', 10 );

    if( point->coordinates().altitude() ) {
        coordinateString += ',';
        coordinateString += QString::number( point->coordinates().altitude() , 'f' , 10);
    }

    writer.writeCharacters( coordinateString );
    writer.writeEndElement();

    KmlGroundOverlayWriter::writeAltitudeMode( writer, point->altitudeMode() );

    writer.writeEndElement();

    return true;
}
开发者ID:sutirthaghosh,项目名称:marble,代码行数:37,代码来源:KmlPointTagWriter.cpp


注:本文中的GeoWriter::writeOptionalElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。