[WorldWind学习]20.修改ShapeFileLayer类及托管D3D文字绘制方法
PluginSDK\ShapeFileLayer.cs Line:1027
char[] fieldDataChars = dbfReader.ReadChars(fieldHeaders[j].FieldLength);
string fieldData = new string( fieldDataChars );
为
byte[] fieldDataChars = dbfReader.ReadBytes(fieldHeaders[j].FieldLength);
string fieldData = System.Text.Encoding.Default.GetString( fieldDataChars );
if(m_LabelList.Count > )
{
System.Drawing.Color iconColor = System.Drawing.Color.FromArgb(m_IconOpacity, , , );
foreach(Shapefile_Point p in m_LabelList)
{
Vector3 cartesianPoint = MathEngine.SphericalToCartesian(p.Y, p.X, drawArgs.WorldCamera.WorldRadius + drawArgs.WorldCamera.TerrainElevation);
if(!drawArgs.WorldCamera.ViewFrustum.ContainsPoint(cartesianPoint) ||MathEngine.SphericalDistanceDegrees(p.Y, p.X, drawArgs.WorldCamera.Latitude.Degrees, drawArgs.WorldCamera.Longitude.Degrees) > 90.0)
continue;
Vector3 projectedPoint = drawArgs.WorldCamera.Project(cartesianPoint - referenceCenter); m_Sprite.Begin(SpriteFlags.AlphaBlend);
if(m_IconTexture != null)
{
float xscale = (float)m_IconWidth / m_IconTextureDescription.Width;
float yscale = (float)m_IconHeight / m_IconTextureDescription.Height;
m_Sprite.Transform = Matrix.Scaling(xscale,yscale,);
m_Sprite.Transform *= Matrix.Translation(projectedPoint.X, projectedPoint.Y, );
m_Sprite.Draw( m_IconTexture,
new Vector3( m_IconWidth>>, m_IconHeight>>,),
Vector3.Empty,
iconColor.ToArgb() ); // Reset transform to prepare for text rendering later
m_Sprite.Transform = Matrix.Identity;
} if(m_ShapeTileArgs.ShowLabels && m_ShapeTileArgs.DataKey != null)
{
// Render label
if(p.Tag != null)
{
// Render name field
const int labelWidth = ; // Dummy value needed for centering the text
if(m_IconTexture==null)
{
// Center over target as we have no bitmap
Rectangle rect = new Rectangle(
(int)projectedPoint.X - (labelWidth>>),
(int)(projectedPoint.Y - (drawArgs.defaultDrawingFont.Description.Height >> )),
labelWidth,
drawArgs.screenHeight ); drawArgs.defaultDrawingFont.DrawText(m_Sprite, p.Tag.ToString(), rect, DrawTextFormat.Center, m_ShapeTileArgs.LabelColor);
}
else
{
// Adjust text to make room for icon
int spacing = (int)(m_IconWidth * 0.3f);
if(spacing>)
spacing = ;
int offsetForIcon = (m_IconWidth>>) + spacing; Rectangle rect = new Rectangle(
(int)projectedPoint.X + offsetForIcon,
(int)(projectedPoint.Y - (drawArgs.defaultDrawingFont.Description.Height >> )),
labelWidth,
drawArgs.screenHeight ); drawArgs.defaultDrawingFont.DrawText(m_Sprite, p.Tag.ToString(), rect, DrawTextFormat.WordBreak, m_ShapeTileArgs.LabelColor);
}
}
}
m_Sprite.End();
}
}
有一个文字3D世界坐标点投影到屏幕的过程,在屏幕绘制。
[WorldWind学习]20.修改ShapeFileLayer类及托管D3D文字绘制方法的更多相关文章
- Java基础学习笔记十二 类、抽象类、接口作为方法参数和返回值以及常用API
不同修饰符使用细节 常用来修饰类.方法.变量的修饰符 public 权限修饰符,公共访问, 类,方法,成员变量 protected 权限修饰符,受保护访问, 方法,成员变量 默认什么也不写 也是一种权 ...
- C++学习20 虚基类详解
多继承时很容易产生命名冲突,即使我们很小心地将所有类中的成员变量和成员函数都命名为不同的名字,命名冲突依然有可能发生,比如非常经典的菱形继承层次.如下图所示: 类A派生出类B和类C,类D继承自类B和类 ...
- 动态修改Python类和实例的方法(转)
相信很多朋友在编程的时候都会想修改一下已经写好的程序行为代码,而最常见的方式就是通过子类来重写父类的一些不满足需求的方法.比如说下面这个例子. class Dog: def bark(self): p ...
- Python小白学习之如何添加类属性和类方法,修改类私有属性
如何添加类属性和类方法,修改类私有属性 2018-10-26 11:42:24 类属性.定义类方法.类实例化.属性初始化.self参数.类的私有变量的个人学习笔记 直接上实例: class play ...
- 9_13学习完整修改和查询&&实体类,数据访问类
完整修改和查询:中间变量运用. 1.先查 2.执行操作 ---------------------------------------------------- namespace ADO.NET_小 ...
- Java学习笔记20(String类应用、StringBuffer类、StringBuilder类)
1.获取指定字符串中大小写和数字的个数: package demo; public class StringTest { public static void main(String[] args) ...
- Java学习-041-颜色工具类(RGB,HEX)
在日常的网页开发中,经常需要进行颜色数值获取.转换,例如获取红色,获取蓝色,获取绿色,RGB转十六进制颜色,十六进制颜色转RGB等,因而在学习过程中,写了一个小工具类,仅供各位小主参考! 多不闲言,直 ...
- (转)Qt Model/View 学习笔记 (七)——Delegate类
Qt Model/View 学习笔记 (七) Delegate 类 概念 与MVC模式不同,model/view结构没有用于与用户交互的完全独立的组件.一般来讲, view负责把数据展示 给用户,也 ...
- Entity Framework 学习初级篇2--ObjectContext类的介绍
转自:http://www.cnblogs.com/Tally/archive/2012/09/14/2685014.html 本节,简单的介绍EF中的ObjectContext.ObjectQuer ...
随机推荐
- sublime text 2 破解
本文是介绍sublime text 2.0.2 build 2221 64位 的破解 在你使用sublime时可能经常出现下图: 这是在提醒你注册 在工具栏上点击help->Enter Lice ...
- testNG框架提示:Cannot find class in classpath: NewTest
selenium+Java的testNG运行时,报如下错误: org.testng.TestNGException: Cannot find class in classpath: NewTest a ...
- java日志之log4j简单使用
1.导入包log4j.jar 2.src同级创建并设置log4j.properties ### 设置### log4j.rootLogger = debug,stdout,D,E ### 输出信息到控 ...
- Python urllib2 模块
urllib2.urlopen(url, data=None, timeout=<object object>) :用于打开一个URL,URL可以是一个字符串也可以是一个请求对象,data ...
- CentOS6.4环境下布署LVS+keepalived笔记
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://400053.blog.51cto.com/390053/713566 环境: 1 ...
- N32903系列的基础知识(1)
N32903U1DN使用ARM926EJ-S内核,其内部集成的JPEG编解码器.CMOS摄像头接口.32通道的声音处理单元(SPU).ADC.DAC等不仅可以满足各种的应用需求,还能减少生产方面的物料 ...
- php学习四:数组(一)
1. 直接赋值方式: ① 索引数组:以索引来存储数据,内存不是连续的,但是js中的内存是连续的 代码如下: $array[0] = "11"; $array[1] = &qu ...
- Mybatis返回map集合
<resultMap id="pieMap" type="HashMap"> <result property="value&quo ...
- BNU4207:台风
东方非想天则(TH12.3)是一款优秀的格斗游戏,其以华丽的弹幕,连贯的技能衔接及优美的音乐吸引了众多玩家(宅男更多-_-),而且各平台上也为其提供了联机的机会. 好了,言归正传,天气系统是本游戏的一 ...
- c++ 利用new动态的定义二维数组
#include <iostream> using namespace std; int main() { , col = ; // key code: 申请空间 int **edge = ...