![]() | NXMapLayerGPU Class |
Namespace: Pixoneer.NXDL.NXMap
public class NXMapLayerGPU : NXMapLayer
The NXMapLayerGPU type exposes the following members.
Name | Description | |
---|---|---|
![]() | NXMapLayerGPU | NXMapLayerGPU 객체를 생성하고 데이터 멤버를 초기화한다. 기본 생성자. |
Name | Description | |
---|---|---|
![]() | LayerVisible | 레이어의 도시여부를 확인하거나 설정한다. (Overrides NXMapLayerLayerVisible.) |
Name | Description | |
---|---|---|
![]() | OnOrthoRender | 레이어가 렌더링될 때 사용자가 객체를 정사투영형태로 도시하려고 하면, 여기에 도시 코드를 추가하면 된다.
이 이벤트 함수에서는 화면 좌표 체계로 구현되어야 한다. |
![]() | OnPreTranslateMessage | 윈도우 메시지가 처리되면 이 이벤트 함수가 발생한다. |
![]() | OnRender | 레이어가 렌더링될 때 사용자가 객체를 원근법에 따라 도시하려고 하면, 여기에 도시 코드를 추가하면 된다.
이 이벤트 함수에서는 world 좌표 체계로 구현되어야 한다. |
partial class FormMain { private Pixoneer.NXDL.NXMap.NXMapView nxMapView1; private Pixoneer.NXDL.NXMap.NXMapLayerGPU nxMapLayerGPU1; public XTextPrinter m_TextPrinter; public XTextPrinter m_TextPrinter2; public XTexture m_TexLogo; private void InitializeComponent() { this.nxMapView1 = new Pixoneer.NXDL.NXMap.NXMapView(); this.nxMapLayerGPU1 = new Pixoneer.NXDL.NXMap.NXMapLayerGPU(); this.nxMapLayerGPU1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.nxMapLayerGPU1.Location = new System.Drawing.Point(20, 110); this.nxMapLayerGPU1.Name = "nxMapLayerGPU1"; this.nxMapLayerGPU1.Size = new System.Drawing.Size(145, 30); this.nxMapLayerGPU1.TabIndex = 2; this.nxMapLayerGPU1.Visible = false; this.nxMapLayerGPU1.OnOrthoRender += new Pixoneer.NXDL.NXMap.NXMapLayerGPU_Event_OrthoRender(this.nxMapLayerGPU1_OnOrthoRender); this.nxMapLayerGPU1.OnRender += new Pixoneer.NXDL.NXMap.NXMapLayerGPU_Event_Render(this.nxMapLayerGPU1_OnRender); this.nxMapView1.Controls.Add(this.nxMapLayerGPU1); } public FormMain() { InitializeComponent(); m_TextPrinter = new XTextPrinter(); Font myFont = new Font("Gulim", 12, FontStyle.Strikeout | FontStyle.Underline | FontStyle.Bold); m_TextPrinter.Initialize(myFont); m_TextPrinter2 = new XTextPrinter(); Font myFont2 = new Font("Gulim", 15, FontStyle.Strikeout | FontStyle.Underline | FontStyle.Bold); m_TextPrinter2.Initialize(myFont2); m_TexLogo = new XTexture(); m_TexLogo.Load("D:/Images/logo.bmp"); } private bool nxMapLayerGPU1_OnRender(NXMapLayerGPU sender, NXMapViewDrawArgs DrawArgs) { XGraphics g = DrawArgs.Graphics; g.glBegin(XGraphics.GL_LINES); g.glColor(Color.Red); g.glVertex3d(DrawArgs.LLWorld); g.glVertex3d(DrawArgs.URWorld); g.glColor3f(1.0f, 1.0f, 1.0f); g.glEnd(); if (m_TextPrinter != null) { XVertex3d vw = DrawArgs.Vertex3d(DrawArgs.MousePosWorld); m_TextPrinter.Print("hello", vw, new XVertex2d(0, 0), new XVertex2d(0.5, 0.5), Color.Blue, true, Color.Green); } return default(bool); } private bool nxMapLayerGPU1_OnOrthoRender(NXMapLayerGPU sender, NXMapViewDrawArgs DrawArgs) { XGraphics g = DrawArgs.Graphics; if (m_TexLogo!=null && m_TexLogo.Loaded) { if (!m_TexLogo.InDevice) m_TexLogo.SendTextureToDevice(); g.glDisable(XGraphics.GL_DEPTH_TEST); g.glEnable(XGraphics.GL_TEXTURE_2D); g.glBindTexture(XGraphics.GL_TEXTURE_2D, (uint)m_TexLogo.GLTextureID); g.glColor(Color.White); g.glBegin(XGraphics.GL_QUADS); g.glTexCoord2f(0, 1); g.glVertex2d(nxMapView1.Width - 215, nxMapView1.Height - 84); g.glTexCoord2f(0, 0); g.glVertex2d(nxMapView1.Width - 215, nxMapView1.Height - 10); g.glTexCoord2f(1, 0); g.glVertex2d(nxMapView1.Width - 10, nxMapView1.Height - 10); g.glTexCoord2f(1, 1); g.glVertex2d(nxMapView1.Width - 10, nxMapView1.Height - 84); g.glEnd(); g.glEnable(XGraphics.GL_DEPTH_TEST); g.glDisable(XGraphics.GL_TEXTURE_2D); } if (m_TextPrinter!=null) { g.glDisable(XGraphics.GL_DEPTH_TEST); g.glEnable(XGraphics.GL_BLEND); g.glBlendFunc(XGraphics.GL_SRC_ALPHA, XGraphics.GL_ONE_MINUS_SRC_ALPHA); g.glColor4f(0.0f, 0.7f, 0.0f, 0.0f); g.glBegin(XGraphics.GL_QUADS); g.glVertex2d(0, nxMapView1.Height - 50); g.glColor4f(0.7f, 0.0f, 0.7f, 0.0f); g.glVertex2d(nxMapView1.Width, nxMapView1.Height - 50); g.glColor4f(0.7f, 0.0f, 0.7f, 0.5f); g.glVertex2d(nxMapView1.Width, nxMapView1.Height); g.glColor4f(0.0f, 0.7f, 0.0f, 0.5f); g.glVertex2d(0, nxMapView1.Height); g.glEnd(); g.glDisable(XGraphics.GL_BLEND); g.glEnable(XGraphics.GL_DEPTH_TEST); XVertex3d posWorld = new XVertex3d(0, 30, 0); XVertex2d posOffset = new XVertex2d(0, 0); XVertex2d align = new XVertex2d(0, 0.5); m_TextPrinter.Print("hello", posWorld, posOffset, align, Color.Red, true, Color.Yellow); XVertex3d posWorld2 = new XVertex3d(nxMapView1.Width / 2.0, nxMapView1.Height / 2, 0); XVertex2d posOffset2 = new XVertex2d(0, 0); XVertex2d align2 = new XVertex2d(0, 0.5); m_TextPrinter2.Print("world", posWorld2, eTextAlign.Align_Right, Color.Red, true, Color.Green); posWorld.x = nxMapView1.Width / 2.0; align.x = 0.5; } return default(bool); } }