OSGEarth支持中文方法
来源:互联网 发布:盛世的蝼蚁知乎 编辑:程序博客网 时间:2024/05/22 08:09
OSGEarth 支持中文需要修改osgearth的源码:
主要影响到plcaeNode 及labelControl
修改步骤如下:
一:在osgearth包下,StringUtil类中添加 字符转换方法:
StringUtil.h头文件中添加:extern OSGEARTH_EXPORT wchar_t* str2wstr( std::string s );
StringUtil.cpp中添加实现:
wchar_t*
osgEarth::str2wstr(std::string s)//ago change
{
setlocale(LC_ALL, "chs");
//int requiredSize = mbstowcs(NULL, s, 0)+1;
int requiredSize = s.size() * 2 + 2;
wchar_t* wtext = new wchar_t[requiredSize + 1];
mbstowcs(wtext, s.c_str(), requiredSize + 1);
return wtext;
//setlocale(LC_ALL, "C");
}
二:修改AnnotationUtils::createTextDrawable函数(在osgearth::annoation包中)
// t->setText( text, text_encoding ); 修改为:
t->setText(osgEarth::str2wstr(text.c_str()));
三:修改
LabelControl::calcSize函数中 (880行左右)
// t->setText( _text, _encoding ); 改为下面:
t->setText(osgEarth::str2wstr(_text.c_str())); //修改中文支持
0 0
- OSGEarth支持中文方法
- osg、osgearth支持中文
- osgEarth支持中文过程详解
- 解决osgEarth中文显示乱码的几种方法
- osgEarth 2.2 中文问题
- 22讲,osgearth中文
- osgearth中文乱码问题
- 不改源码的方式实现osgearth当中placenode的中文支持
- OSG和osgearth显示中文
- OSG和osgearth显示中文
- OSG和osgearth显示中文
- reflector的中文支持方法
- MySQL支持中文的方法
- dillo2.2支持中文方法
- MySql支持中文的方法
- python中支持中文方法
- delphi for php 支持中文的方法
- Aptana Studio 1.0 支持中文的方法
- IOS 如何改变push的方向
- Opengl(三)——渲染出一个三角形
- 初入android,android studio熟悉(五)
- java.lang.Short.parseShort(String s)方法实例
- python学习笔记二--itertools
- OSGEarth支持中文方法
- 利用UIWindow自定义类似UIAlertView的弹出框
- 分布式服务框架 Zookeeper -- 管理分布式环境中的数据
- 杭电1249
- Hadoop DistributedCache详解
- Git配置全局和独立仓库的username和email配置
- MySQL数据库修改名称的三种方法
- nginx虚拟主机配置
- NET中const、readonly、sealed与JAVA中final的差异