示例#1
0
        private void OverlayADVState(Graphics g, Bitmap currentImage, FrameStateData state, RenderFrameContext context)
        {
            if (TangraConfig.Settings.ADVS.OverlayTimestamp)
            {
                string timeStampStr = state.HasValidTimeStamp
                                                ? string.Format("{0}.{1}", state.CentralExposureTime.ToString("dd MMM yyyy HH:mm:ss"), state.CentralExposureTime.Millisecond.ToString().PadLeft(3, '0'))
                                                : "Embedded Timestamp Not Found";
                g.DrawString(timeStampStr, s_TimeStampFont, s_TimeStampBrush, m_XPos, currentImage.Height - m_YPosUpper);
                g.Save();
            }

            int numTopLines = 0;

            if (TangraConfig.Settings.ADVS.OverlayObjectName && m_AdvFileMetadataInfo != null && !string.IsNullOrWhiteSpace(m_AdvFileMetadataInfo.ObjectName) &&
                (!m_ObjectInfoDisplayed || m_FirstFrameNo == context.CurrentFrameIndex))
            {
                string objectNameStr = string.Format(" {0}", m_AdvFileMetadataInfo.ObjectName);
                g.DrawString(objectNameStr, s_PropertiesFont, s_PropertiesGreenBrush, 10, 10 + numTopLines * (s_PropertiesFont.Size + 5));
                g.Save();
                numTopLines++;
                m_ObjectInfoDisplayed = true;
            }

            if (m_LastFrameNo + 1 != context.CurrentFrameIndex)
            {
                // When frames jump we stop displaying the message
                m_FramesLeftToDiplayMessage = 0;
            }

            if (TangraConfig.Settings.ADVS.OverlayAllMessages &&
                !string.IsNullOrEmpty(state.Messages) &&
                state.Messages.Trim().Length > 0)
            {
                m_LastMessage = state.Messages.Trim();
                m_FramesLeftToDiplayMessage = context.MovementType == MovementType.Step ? 1 : 10;
            }

            if ((TangraConfig.Settings.ADVS.OverlayAdvsInfo || TangraConfig.Settings.ADVS.OverlayCameraInfo || TangraConfig.Settings.ADVS.OverlayGeoLocation) &&
                (!m_EquipmentInfoDisplayed || m_FirstFrameNo == context.CurrentFrameIndex))
            {
                int numLines = 0;
                int lineNo   = 0;
                if (TangraConfig.Settings.ADVS.OverlayCameraInfo)
                {
                    numLines += 2;
                }
                if (TangraConfig.Settings.ADVS.OverlayAdvsInfo)
                {
                    numLines += 2;
                }
                if (TangraConfig.Settings.ADVS.OverlayGeoLocation)
                {
                    numLines += 1;
                }

                float startingY = currentImage.Height - numLines * (s_PropertiesFont.Size + 5) - 10;
                if (TangraConfig.Settings.ADVS.OverlayTimestamp)
                {
                    startingY -= m_YPosUpper;
                }

                if (TangraConfig.Settings.ADVS.OverlayAdvsInfo && m_AdvFileMetadataInfo != null)
                {
                    g.DrawString(m_AdvFileMetadataInfo.Recorder, s_PropertiesFont, s_PropertiesWhiteBrush, 10, startingY + lineNo * (s_PropertiesFont.Size + 5));
                    lineNo++;
                    if (!string.IsNullOrEmpty(m_AdvFileMetadataInfo.AdvrVersion))
                    {
                        g.DrawString(
                            string.Format("ADVR v{0} HTCC v{1}", m_AdvFileMetadataInfo.AdvrVersion, m_AdvFileMetadataInfo.HtccFirmareVersion),
                            s_PropertiesFont, s_PropertiesWhiteBrush, 10, startingY + lineNo * (s_PropertiesFont.Size + 5));
                    }
                    lineNo++;
                }

                if (TangraConfig.Settings.ADVS.OverlayCameraInfo && m_AdvFileMetadataInfo != null)
                {
                    if (!string.IsNullOrEmpty(m_AdvFileMetadataInfo.SensorInfo))
                    {
                        g.DrawString(m_AdvFileMetadataInfo.SensorInfo, s_PropertiesFont, s_PropertiesWhiteBrush, 10, startingY + lineNo * (s_PropertiesFont.Size + 5));
                    }
                    lineNo++;
                    if (!string.IsNullOrEmpty(m_AdvFileMetadataInfo.Camera))
                    {
                        g.DrawString(m_AdvFileMetadataInfo.Camera, s_PropertiesFont, s_PropertiesWhiteBrush, 10, startingY + lineNo * (s_PropertiesFont.Size + 5));
                    }
                    lineNo++;
                }

                if (TangraConfig.Settings.ADVS.OverlayGeoLocation && m_GeoLocation != null)
                {
                    g.DrawString(m_GeoLocation.GetFormattedGeoLocation(), s_PropertiesFont, s_PropertiesWhiteBrush, 10, startingY + lineNo * (s_PropertiesFont.Size + 5));
                    lineNo++;
                }

                g.Save();

                m_EquipmentInfoDisplayed = true;
            }

            if (m_FramesLeftToDiplayMessage > 0)
            {
                if (TangraConfig.Settings.ADVS.OverlayObjectName)
                {
                    numTopLines++;
                }

                g.DrawString(m_LastMessage, s_PropertiesFont, s_PropertiesYellowBrush, 10, 10 + numTopLines * (s_PropertiesFont.Size + 5));
                g.Save();
                m_FramesLeftToDiplayMessage--;
            }
        }