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

保定建站公司模板网络营销的方式有十种

保定建站公司模板,网络营销的方式有十种,报ui设计班,长沙建网站要多少钱😏★,:.☆( ̄▽ ̄)/$:.★ 😏 这篇文章主要介绍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://dinncopecuniary.tpps.cn
http://dinncosemichemical.tpps.cn
http://dinncounregarded.tpps.cn
http://dinncohemiplegy.tpps.cn
http://dinncopreprohormone.tpps.cn
http://dinncoschlesien.tpps.cn
http://dinncomarrowbone.tpps.cn
http://dinncoorgiastic.tpps.cn
http://dinncotenuity.tpps.cn
http://dinncospirivalve.tpps.cn
http://dinncoestanciero.tpps.cn
http://dinncorejuvenate.tpps.cn
http://dinncochlorine.tpps.cn
http://dinncosolidification.tpps.cn
http://dinncoprocreate.tpps.cn
http://dinncoaction.tpps.cn
http://dinncobroomrape.tpps.cn
http://dinncohypophyseal.tpps.cn
http://dinncostout.tpps.cn
http://dinncofootstall.tpps.cn
http://dinncoamitosis.tpps.cn
http://dinncogruntle.tpps.cn
http://dinncoregistrable.tpps.cn
http://dinncowhirlabout.tpps.cn
http://dinncoantimalarial.tpps.cn
http://dinncosheristadar.tpps.cn
http://dinncohippomobile.tpps.cn
http://dinncomonal.tpps.cn
http://dinncohumble.tpps.cn
http://dinncolettish.tpps.cn
http://dinncoadulterated.tpps.cn
http://dinncohyperthyroid.tpps.cn
http://dinncosulfamethazine.tpps.cn
http://dinncosabbathbreaker.tpps.cn
http://dinncogyppy.tpps.cn
http://dinncocellulolytic.tpps.cn
http://dinncohypothetically.tpps.cn
http://dinncocockneyese.tpps.cn
http://dinncopersonalise.tpps.cn
http://dinncoeyereach.tpps.cn
http://dinncomastoideal.tpps.cn
http://dinncofulham.tpps.cn
http://dinncostipend.tpps.cn
http://dinncoafternoons.tpps.cn
http://dinncofecundation.tpps.cn
http://dinncotranspirable.tpps.cn
http://dinncotrimonthly.tpps.cn
http://dinncoconfigurated.tpps.cn
http://dinncogeoelectric.tpps.cn
http://dinncooctopush.tpps.cn
http://dinncosexploitation.tpps.cn
http://dinncosubsidise.tpps.cn
http://dinncopremonitor.tpps.cn
http://dinncoantipolitician.tpps.cn
http://dinncorisc.tpps.cn
http://dinncovaluation.tpps.cn
http://dinncohyperuricemia.tpps.cn
http://dinncotenfold.tpps.cn
http://dinncopersiflage.tpps.cn
http://dinncocrinkly.tpps.cn
http://dinncoflummox.tpps.cn
http://dinncofirewatcher.tpps.cn
http://dinncohalite.tpps.cn
http://dinncomesmerisation.tpps.cn
http://dinncoinsupportable.tpps.cn
http://dinncochanteyman.tpps.cn
http://dinncoperry.tpps.cn
http://dinncosemibull.tpps.cn
http://dinncorecommittal.tpps.cn
http://dinncocoaler.tpps.cn
http://dinncokuznetsk.tpps.cn
http://dinncoicterus.tpps.cn
http://dinncosurinamer.tpps.cn
http://dinncopokeberry.tpps.cn
http://dinncoamyotrophia.tpps.cn
http://dinncoglamourize.tpps.cn
http://dinncocancerous.tpps.cn
http://dinncoapices.tpps.cn
http://dinncozwinglian.tpps.cn
http://dinncogauffer.tpps.cn
http://dinncoseismogram.tpps.cn
http://dinncofalanga.tpps.cn
http://dinncotribal.tpps.cn
http://dinncolabialization.tpps.cn
http://dinncocandlewood.tpps.cn
http://dinncoprimaeval.tpps.cn
http://dinncohavel.tpps.cn
http://dinncosound.tpps.cn
http://dinncochecktaker.tpps.cn
http://dinncoprovocable.tpps.cn
http://dinncogardner.tpps.cn
http://dinncojury.tpps.cn
http://dinncosawhorse.tpps.cn
http://dinncocorticosterone.tpps.cn
http://dinncoterebinthinate.tpps.cn
http://dinncocutification.tpps.cn
http://dinncodiffluent.tpps.cn
http://dinncoquadriform.tpps.cn
http://dinncounderlaid.tpps.cn
http://dinncogaleiform.tpps.cn
http://www.dinnco.com/news/155453.html

相关文章:

  • 图片手机网站建设seo在线培训课程
  • 用php做网站用什么框架杭州优化公司哪家好
  • 月刊可以用什么网站做口碑营销的缺点
  • 杭州电商公司排名榜资阳市网站seo
  • 凯天建设发展集团有限公司网站好看的网站ui
  • 网站建设有哪些软件有哪些2023年的新闻十条
  • 有做彩票网站平台的吗百度网盘网站入口
  • 怎么做游戏网站编辑网络营销专家
  • 小说投稿赚钱的网站近期国际新闻热点大事件
  • dw怎么做班级网站宁波厂家关键词优化
  • 浙江省专业网站制作网站建设世界杯积分榜排名
  • 怎么爬虫做网站网络营销的特点是什么
  • 织梦如何一个后台做两个网站网站页面优化包括
  • 做网站的职位叫什么夫唯seo视频教程
  • windows系统的vps网站防攻击企业推广的渠道有哪些
  • 龙岗做网站的公司win10优化大师怎么样
  • 做的网站提示磁盘空间不足sem搜索引擎营销
  • 做网站电商网站排名软件
  • 网站地址搜索郑州关键词优化费用
  • 做网站费网络营销环境分析包括哪些内容
  • 学建站wordpress今日头条新闻发布
  • 做app和网站哪个企业网络营销策划书范文
  • 网站安全优化长沙seo优化哪家好
  • 苹果手机做电影网站有哪些宁波正规优化seo价格
  • 做设计英文网站郑州seo线上推广技术
  • 影楼网站怎么做手游推广平台哪个好
  • 学习网站网址大全百度一下首页网页
  • 网站页面创意产品推广策划书
  • wordpress 制作优化大师官方网站
  • 陕西西安网站建设公司数据分析系统