public override void Load()
		{
            //set plugin directory
            if (PluginDirectory.ToLower().EndsWith("gpstracker"))
                m_sPluginDirectory = PluginDirectory;
            else
                m_sPluginDirectory = PluginDirectory + "\\plugins\\gpstracker";

            try
            {
                Directory.CreateDirectory(m_sPluginDirectory + "\\NMEAExport");
            }
            catch (Exception)
            {
            }

			gpsOverlay=null;
			pluginAddOverlay();

			//create new instance of gpstracker
			gpsTracker = new GpsTracker(this);
			// Add the GPSTracker plugin to the World Wind tool bar 
            m_MenuButton = new WindowsControlMenuButton("Gps Tracker", m_sPluginDirectory + "\\gpstracker.png", this.gpsTracker);
			Application.WorldWindow.MenuBar.AddToolsMenuButton( m_MenuButton );
			
			base.Load();
		}
Beispiel #2
0
		public POIName(GPSTrackerOverlay gpsOverlay)
		{
			m_gpsOverlay = gpsOverlay;
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}
		public void pluginRemoveOverlay()
		{
			if (gpsOverlay!=null)
			{
				Application.WorldWindow.CurrentWorld.RenderableObjects.Remove(gpsOverlay.Name);
				gpsOverlay=null;
			}
		}
		public void pluginAddOverlay()
		{
			gpsOverlay = new GPSTrackerOverlay(this);
			gpsOverlay.Initialize(Application.WorldWindow.DrawArgs);
			Application.WorldWindow.CurrentWorld.RenderableObjects.Add(gpsOverlay);
			gpsOverlay.Update(Application.WorldWindow.DrawArgs);
		}
		public void SetTrack(GPSTrackerOverlay gpsTrackerOverlay,GPSTrack gpsTrack,string sDescription,Color colorTrack, string sIcon, bool bShowInfo)
		{
			m_gpsTrack=gpsTrack;
			m_gpsTrackerOverlay = gpsTrackerOverlay;
            m_bShowInfo = bShowInfo;

			m_uVerticesCount=(gpsTrack.m_uPointCount/50000)+1;
			m_fTotalDistance=0;
			m_colorTrack=colorTrack;
			m_fCurrentVerticalExaggeration = -1F;
			m_bCalculateDistance = true;

            m_fStartAlt = gpsTrack.m_fAlt[0];
            m_fStartLatitud = gpsTrack.m_fLat[0];
            m_fStartLongitude = gpsTrack.m_fLon[0];
            m_sDescription = sDescription;
            m_sIconFileName = sIcon;
			if (m_sIconFileName=="")
				m_sIconFileName = GpsTrackerPlugin.m_sPluginDirectory + "\\Gpsx.png";
			
					
#if !DEBUG
            try
#endif
            {
                this.texture = TextureLoader.FromFile(m_drawArgs.device, this.m_sIconFileName, 0, 0, 1, 0, Format.Unknown, Pool.Managed, Filter.Box, Filter.Box, 0);
            }
#if !DEBUG
            catch (Microsoft.DirectX.Direct3D.InvalidDataException)
            {
                this.texture = TextureLoader.FromFile(m_drawArgs.device, GpsTrackerPlugin.m_sPluginDirectory + "\\gpsx.png", 0, 0, 1, 0, Format.Unknown, Pool.Managed, Filter.Box, Filter.Box, 0);
            }
#endif

            using (Surface s = this.texture.GetSurfaceLevel(0))
            {
                SurfaceDescription desc = s.Description;
                this.m_iTextureWidth = desc.Width;
                this.m_iTextureHeight = desc.Height;
                this.m_iIconWidth = desc.Width;
                this.m_iIconHeight = desc.Height;
                this.m_iIconWidthHalf = desc.Width / 2;
                this.m_iIconHeightHalf = desc.Height / 2;

                this.spriteSize = new Rectangle(0, 0, desc.Width, desc.Height);
            }

            this.isSelectable = true;

            this.sprite = new Sprite(m_drawArgs.device);


			this.isInitialized = true;
			this.RenderPriority = RenderPriority.Icons;
		}
		public override void Unload()
		{
			// Clean up
			gpsTracker.Close();
			
			//remove button...
			Application.WorldWindow.MenuBar.RemoveToolsMenuButton(m_MenuButton);

			pluginRemoveOverlay();

			m_MenuButton=null;
			gpsTracker=null;
			gpsOverlay=null;
			base.Unload ();
		}
		public GPSIcon(
			GPSTrackerOverlay gpsTrackerOverlay,
			GPSRenderInformation renderInformation,
			World parentWorld)
			: base(renderInformation.sDescription, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0)) 
		{
			m_fVerticalExaggeration = World.Settings.VerticalExaggeration;
			m_RenderInfo=renderInformation;
			m_RenderInfo.bPOI=false;
			this.m_gpsTrackerOverlay=gpsTrackerOverlay;
			this.m_parentWorld = parentWorld;
			this.m_textureFileName = m_RenderInfo.sIcon;
			this.m_iTextureWidth = 32;
			this.m_iTextureHeight = 32;
			this.m_iIconWidth = 32;
			this.m_iIconHeight = 32;
			this.m_iIconWidthHalf = m_iIconWidth/2;
			this.m_iIconHeightHalf = m_iIconHeight/2;
			m_bSignalDistance=false;
			this.m_bTrack=renderInformation.fTrack;
			m_bShowInfo = m_RenderInfo.bShowInfo;
            m_bTrackLine = m_RenderInfo.bTrackLine;
            m_bTrackHeading = gpsTrackerOverlay.Plugin.gpsTracker.m_bTrackHeading;

			m_fLastAlt=-1000000F;
			m_fLastRoll=-1000F;
			m_fLastDepth=-1000000F;
			m_fLastPitch=-1000F;
			m_fLastSpeed=-1F;
			m_fLastESpeed=-1000000F;
			m_fLastNSpeed=-1000000F;
			m_fLastVSpeed=-1000000F;
			m_fLastHeading=-1F;
			m_iLastHour=-1;
			m_iLastMin=-1;
			m_fLastSec=(float)-1;
			m_iLastDay=-1;
			m_iLastMonth=-1;
			m_iLastYear=-1;
			m_fLatitudeFrom=1000F;
			m_fLongitudeFrom=1000F;
			m_sDescriptionFrom="";

			m_uVerticesCount=0;
			m_uPointCount=0;
			m_fTotalDistance=0;
			m_uTotalPointCount=0;

			for (int i=0; i<m_gpsTrackerOverlay.m_iGpsIconIndex; i++)
				if (m_gpsTrackerOverlay.m_gpsIcons[i].m_RenderInfo.iIndex==m_RenderInfo.iIndex && 
					m_gpsTrackerOverlay.m_gpsIcons[i].m_bTrack &&
					m_bTrack)
					m_bTrack=false;

			this.RenderPriority = RenderPriority.Icons;
		}
        //static int VK_RCONTROL = 0xA3;
        //static int VK_LALT = 0xA4;
        //static int VK_RALT = 0xA5;

		//float fFeetToMeter = 31F/100F;

		public GPSIcon(
			GPSTrackerOverlay gpsTrackerOverlay,
			int iIndex, 
			GPSRenderInformation renderInformation,
			World parentWorld)
			: base(renderInformation.sDescription, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0)) 
		{
			m_fVerticalExaggeration = World.Settings.VerticalExaggeration;
			m_RenderInfo=renderInformation;
			m_RenderInfo.bPOI=true;
			this.m_gpsTrackerOverlay=gpsTrackerOverlay;
			m_RenderInfo.iIndex=iIndex;
			this.m_parentWorld = parentWorld;
			this.m_textureFileName = m_RenderInfo.sIcon;
			this.m_iTextureWidth = 32;
			this.m_iTextureHeight = 32;
			this.m_iIconWidth = 32;
			this.m_iIconHeight = 32;
			this.m_iIconWidthHalf = m_iIconWidth/2;
			this.m_iIconHeightHalf = m_iIconHeight/2;
			this.m_bTrack=renderInformation.fTrack;
			m_bShowInfo = m_RenderInfo.bShowInfo;

			m_fLatitudeFrom=1000F;
			m_fLongitudeFrom=1000F;
			m_sDescriptionFrom="";
			m_bSignalDistance=false;

			m_uVerticesCount=0;
			m_uPointCount=0;
			m_fTotalDistance=0;
			m_uTotalPointCount=0;

			this.RenderPriority = RenderPriority.Icons;
		}