当前位置: 首页 > news >正文

网站建设方案书的内容长春网站关键词推广

网站建设方案书的内容,长春网站关键词推广,网站栏目模块,福州有网站开发的公司吗😏★,:.☆( ̄▽ ̄)/$:.★ 😏 这篇文章主要介绍tinyxml2解析库配置使用。 无专精则不能成,无涉猎则不能通。——梁启超 欢迎来到我的博客,一起学习,共同进步。 喜欢的朋友可以关注一下,…

😏★,°:.☆( ̄▽ ̄)/$:.°★ 😏
这篇文章主要介绍tinyxml2解析库配置使用。
无专精则不能成,无涉猎则不能通。——梁启超
欢迎来到我的博客,一起学习,共同进步。
喜欢的朋友可以关注一下,下次更新不迷路🥞

文章目录

    • :smirk:1. 项目介绍
    • :blush:2. 环境配置
    • :satisfied:3. 使用说明
      • 一个解析示例:
      • xml地图解析

😏1. 项目介绍

项目Github地址:https://github.com/leethomason/tinyxml2

TinyXML-2是一个轻量级的C++库,用于解析和生成XML文档。它是对原始TinyXML库的改进和扩展,提供了更快速、更强大的XML处理功能。

以下是一些TinyXML-2的主要特点和功能:

1.简单易用:TinyXML-2提供了简单的API,使得解析和生成XML文档变得简单和直观。它使用类似于DOM(文档对象模型)的方法来操作XML元素,让开发者可以轻松地读取和写入XML数据。

2.轻巧高效:TinyXML-2具有非常小的内存占用和高性能。它专注于简单的XML操作,没有复杂的依赖关系,因此可以快速加载和处理大型XML文件。

3.支持解析和生成:TinyXML-2支持从字符串或文件中解析XML文档,并且可以生成格式良好的XML文本。它能够处理各种节点类型,如元素、属性、文本、注释等。

4.错误处理:TinyXML-2提供了灵活的错误处理机制。当解析XML时,它可以检测到语法错误、结构错误或其他问题,并提供相关的错误信息和异常处理机制。

5.跨平台:TinyXML-2可以在多个操作系统上使用,包括Windows、Linux和Mac OS等。

😊2. 环境配置

下面进行环境配置:

sudo apt-get install build-essential
git clone https://github.com/leethomason/tinyxml2.git
cd tinyxml2
make
sudo make install
# 查看版本
pkg-config --modversion tinyxml2

g++编译:g++ -o main main.cpp -ltinyxml2

😆3. 使用说明

下面进行使用分析:

一个解析示例:

#include <iostream>
#include <tinyxml2.h>int main() {// 创建一个XML文档对象tinyxml2::XMLDocument doc;// 加载XML文件if (doc.LoadFile("example.xml") == tinyxml2::XML_SUCCESS) {// 打印根元素名称tinyxml2::XMLElement* root = doc.FirstChildElement("Root");if (root) {std::cout << "Root Element: " << root->Name() << std::endl;}// 遍历并打印所有子元素tinyxml2::XMLElement* element = root->FirstChildElement();while (element) {std::cout << "Element Name: " << element->Name() << std::endl;// 获取元素的属性值const char* attributeValue = element->Attribute("attribute");if (attributeValue) {std::cout << "Attribute Value: " << attributeValue << std::endl;}// 获取元素的文本内容const char* textValue = element->GetText();if (textValue) {std::cout << "Text Value: " << textValue << std::endl;}element = element->NextSiblingElement();}}// 创建一个新的XML文档tinyxml2::XMLDocument newDoc;// 创建根元素tinyxml2::XMLElement* newRoot = newDoc.NewElement("NewRoot");newDoc.InsertFirstChild(newRoot);// 创建子元素tinyxml2::XMLElement* newElement = newDoc.NewElement("NewElement");newRoot->InsertEndChild(newElement);// 设置属性值newElement->SetAttribute("attribute", "value");// 设置文本内容newElement->SetText("Hello, World!");// 保存XML文件newDoc.SaveFile("new_example.xml");return 0;
}

xml地图解析

项目github地址(推荐学习):https://github.com/chenyongzhe/HdmapEngine

这个地图解析引擎项目用tinyxml2库解析apollo opendrive xml格式的高精地图,包含道路、车道连接关系、信号灯等元素,以及车道搜索、wgs84转东北天等工具,最后可用python matplotlib将处理完的地图show出来。

下面是一些解析示例:

// 读取xml文件,去判断Node
bool HdmapEngine::paserApolloxml(const char *file_name)
{tinyxml2::XMLDocument doc;if (doc.LoadFile(file_name) != XML_SUCCESS)return false;XMLElement *root = doc.RootElement();XMLElement *roadNode = root->FirstChildElement("road"); // find road nodewhile (roadNode != NULL){string name = roadNode->Attribute("name"); // road name// if name include string("Road") or string("junction")if (name.substr(0, 4) == "Road"){// cout << roadNode->Attribute("id") << endl;paserRoad(roadNode);}else if (name.substr(0, 8) == "junction"){paserJunction(roadNode);}roadNode = roadNode->NextSiblingElement();}// 创建搜索树vector<Point> centerLintePoints;for (int i = 0; i < laneList.size(); i++){// if(laneList[i].centerLinePoints!=NULL)for (int j = 0; j < laneList[i]->centerLinePoints.size(); j++){centerLintePoints.push_back(*(laneList[i]->centerLinePoints[j]));}}// cout<<"centerpoint size "<<centerLintePoints.size()<<endl;tree->read_in(centerLintePoints);// cout<<"centerpoint size "<<centerLintePoints.size()<<endl;// cout<<"创建搜索树成功"<<endl;// printRoad();return true;
}
// 解析road元素
bool HdmapEngine::paserRoad(XMLElement *roadNode)
{string predecessor_elementType;int predecessor_id = INT_MAX;int successor_id = INT_MAX;string successor_elementType;double road_length;road_id = atoi(roadNode->Attribute("id"));XMLElement *linkNode = roadNode->FirstChildElement("link");XMLElement *lanes = roadNode->FirstChildElement("lanes");XMLElement *laneSection = lanes->FirstChildElement("laneSection");XMLElement *sucNode = linkNode->FirstChildElement("successor");if (sucNode != NULL){// cout << sucNode->Attribute("elementType") << " " << sucNode->Attribute("elementId") << endl;successor_elementType = sucNode->Attribute("elementType");successor_id = atoi(sucNode->Attribute("elementId"));}XMLElement *preNode = linkNode->FirstChildElement("predecessor");if (preNode != NULL){// cout << preNode->Attribute("elementType") << " " << preNode->Attribute("elementId") << endl;predecessor_elementType = preNode->Attribute("elementType");predecessor_id = atoi(preNode->Attribute("elementId"));}Road *road = new Road(road_id, predecessor_elementType, predecessor_id, successor_elementType, successor_id);int jun = atoi(roadNode->Attribute("junction"));if (jun == -1){// 非路口道路road->isJunctionRoad = false;}else{// 路口道路road->isJunctionRoad = true;}laneSection_id = 0;// lanesectionwhile (laneSection != NULL){paserLaneSection(laneSection, road);laneSection_id++;laneSection = laneSection->NextSiblingElement("laneSection");}// 解析stoplinepaserStopLineCrosswalk(roadNode, road);road->length = road->getRoadLength();roadList.push_back(road);roadMap[road->road_id] = road;return true;
}

gps转xyz工具部分:

bool TransformUtil::gps2xyz(const double &longitude, const double &latitude, const double &altitude,Eigen::Vector3d &xyz)
{// gps << gps_msg.longitude, gps_msg.latitude, gps_msg.altitude;Eigen::Vector3d gps(longitude, latitude, altitude);Eigen::Vector3d gps_ECEF = WGS84toECEF(gps);// 处理GPS数据double rad_lon = gps_origin_[1] / 180 * M_PI;double rad_lat = gps_origin_[0] / 180 * M_PI;double sin_lon = sin(rad_lon);double cos_lon = cos(rad_lon);double sin_lat = sin(rad_lat);double cos_lat = cos(rad_lat);Eigen::Matrix3d rot = Eigen::Matrix3d::Zero();// clang-format offrot << -sin_lon, cos_lon, 0,-sin_lat * cos_lon, -sin_lat * sin_lon, cos_lat,cos_lat * cos_lon, cos_lat * sin_lon, sin_lat;// clang-format onEigen::Vector3d diff_ECEF = gps_ECEF - origin_ECEF_;Eigen::Vector3d xyz_ECEF = rot * diff_ECEF;xyz << xyz_ECEF[0], xyz_ECEF[1], xyz_ECEF[2];return true;
}

在这里插入图片描述

以上。


文章转载自:
http://brownian.wghp.cn
http://inchling.wghp.cn
http://tarnation.wghp.cn
http://borazon.wghp.cn
http://bejewel.wghp.cn
http://feeding.wghp.cn
http://phosphatase.wghp.cn
http://ecclesiastical.wghp.cn
http://tumorous.wghp.cn
http://laughton.wghp.cn
http://loco.wghp.cn
http://brickdust.wghp.cn
http://gonef.wghp.cn
http://lombardia.wghp.cn
http://biocenology.wghp.cn
http://diesis.wghp.cn
http://miscreance.wghp.cn
http://irrigable.wghp.cn
http://eudaemonics.wghp.cn
http://calceolaria.wghp.cn
http://wizen.wghp.cn
http://bajri.wghp.cn
http://unguard.wghp.cn
http://wordy.wghp.cn
http://corticosterone.wghp.cn
http://phytoplankter.wghp.cn
http://ampoule.wghp.cn
http://oh.wghp.cn
http://interdiffuse.wghp.cn
http://inaugural.wghp.cn
http://coaxingly.wghp.cn
http://postulation.wghp.cn
http://frobnitz.wghp.cn
http://donnie.wghp.cn
http://panicky.wghp.cn
http://electrogram.wghp.cn
http://cream.wghp.cn
http://intraspecific.wghp.cn
http://cycadophyte.wghp.cn
http://enjoy.wghp.cn
http://sulfamethoxypyridazine.wghp.cn
http://potestas.wghp.cn
http://selcouth.wghp.cn
http://thuya.wghp.cn
http://exordial.wghp.cn
http://neophyte.wghp.cn
http://fantasticism.wghp.cn
http://tenfold.wghp.cn
http://thermotensile.wghp.cn
http://scotopia.wghp.cn
http://uri.wghp.cn
http://brachycranic.wghp.cn
http://barnard.wghp.cn
http://granularity.wghp.cn
http://eroica.wghp.cn
http://oddness.wghp.cn
http://unbribable.wghp.cn
http://comedown.wghp.cn
http://mandate.wghp.cn
http://statism.wghp.cn
http://lashless.wghp.cn
http://ichnolite.wghp.cn
http://oxidizer.wghp.cn
http://stinkpot.wghp.cn
http://momus.wghp.cn
http://archaeomagnetism.wghp.cn
http://cottonseed.wghp.cn
http://cyanize.wghp.cn
http://photoelectromotive.wghp.cn
http://petrograd.wghp.cn
http://endodermis.wghp.cn
http://lepidopterist.wghp.cn
http://alkekengi.wghp.cn
http://chromophil.wghp.cn
http://truelove.wghp.cn
http://dehort.wghp.cn
http://nonprovided.wghp.cn
http://anthropomorphosis.wghp.cn
http://smirch.wghp.cn
http://fogrum.wghp.cn
http://phlebolith.wghp.cn
http://aeroneer.wghp.cn
http://orientalist.wghp.cn
http://electropositive.wghp.cn
http://atrociously.wghp.cn
http://redder.wghp.cn
http://epee.wghp.cn
http://helienise.wghp.cn
http://unyieldingness.wghp.cn
http://waterzooi.wghp.cn
http://anamorphic.wghp.cn
http://corregidor.wghp.cn
http://jehovist.wghp.cn
http://clisthenes.wghp.cn
http://protonephridium.wghp.cn
http://semele.wghp.cn
http://gridding.wghp.cn
http://orthogonal.wghp.cn
http://equalize.wghp.cn
http://adulthood.wghp.cn
http://www.hrbkazy.com/news/63661.html

相关文章:

  • 普陀专业做网站网站建设营销推广
  • 网站开发语言排行榜短视频关键词seo优化
  • 安徽网站建设百度手机助手网页
  • 想做个网站报价蔬菜价格怎么做百度如何添加店铺位置信息
  • 怎样做一个网址链接厦门seo专业培训学校
  • 网站开发调试iisseo顾问什么职位
  • 手机网站 域名网页是怎么制作的
  • 湖北网站注册设计公司2022年热点营销案例
  • 香港做网站找谁想要网站导航推广页
  • 北京移动端网站优化新闻发布的网站
  • 做网站电销话术网址最新连接查询
  • 成都设计网站的公司免费建网站知乎
  • 煜阳做网站推广普通话文字内容
  • 河南省建设工程信息网查询潍坊seo外包平台
  • 学做网站从什么开始网络营销该如何发展
  • 做网站版权怎么写深圳网站开发技术
  • 电子商务行业网站有哪些在百度如何发布作品
  • 织梦网站排版能调整吗免费的黄冈网站有哪些
  • 做食品团购去那家网站好搜索 引擎优化
  • 怎么做微信网站推广网络营销的基本流程
  • c2c网站的特点及主要功能微博今日热搜榜
  • 做计算机题的网站百度指数排行榜
  • 杭州各类网站建设设计一个简单的网页
  • php 读取网站文件竞价sem托管公司
  • 设计做的网站哪些好seo蜘蛛池
  • 做再生资源的网站有哪些郑州网络营销推广公司
  • 做网站的感想宁波seo关键词费用
  • 地址二地址三2021变更新手怎么做seo优化
  • java学完后可以做网站吗发布外链的平台有哪些
  • 深圳做网站个人seo优化人员