示例#1
0
        internal static Overlay FromXml(TourStop owner, XmlNode overlay)
        {
            if (overlay.Attributes == null)
            {
                return(null);
            }

            if (overlay.Attributes.GetNamedItem("Type") == null)
            {
                return(null);
            }
            string overlayClassName = overlay.Attributes.GetNamedItem("Type").Value.ToString();

            //Type overLayType = Type.GetType(overlayClassName.Replace("TerraViewer.",""));
            string  overLayType = overlayClassName.Replace("TerraViewer.", "");
            Overlay newOverlay  = null;

            //Overlay newOverlay = (Overlay)System.Activator.CreateInstance(overLayType);
            switch (overLayType)
            {
            case "AudioOverlay":
                newOverlay = new AudioOverlay();
                break;

            case "BitmapOverlay":
                newOverlay = new BitmapOverlay();
                break;

            case "FlipBookOverlay":
                newOverlay = new FlipbookOverlay();
                break;

            case "ShapeOverlay":
                newOverlay = new ShapeOverlay();
                break;

            case "TextOverlay":
                newOverlay = new TextOverlay();
                break;

            default:
                return(null);
            }

            newOverlay.owner = owner;
            newOverlay.InitOverlayFromXml(overlay);
            return(newOverlay);
        }
示例#2
0
        internal static Overlay FromXml(TourStop owner, XmlNode overlay)
        {
            if (overlay.Attributes == null)
            {
                return null;
            }

            if (overlay.Attributes.GetNamedItem("Type") == null)
            {
                return null;
            }
            string overlayClassName = overlay.Attributes.GetNamedItem("Type").Value.ToString();

            //Type overLayType = Type.GetType(overlayClassName.Replace("TerraViewer.",""));
            string overLayType = overlayClassName.Replace("TerraViewer.", "");
            Overlay newOverlay = null;

            //Overlay newOverlay = (Overlay)System.Activator.CreateInstance(overLayType);
            switch (overLayType)
            {
                case "AudioOverlay":
                    newOverlay = new AudioOverlay();
                    break;
                case "BitmapOverlay":
                    newOverlay = new BitmapOverlay();
                    break;
                case "FlipBookOverlay":
                    newOverlay = new FlipbookOverlay();
                    break;
                case "ShapeOverlay":
                    newOverlay = new ShapeOverlay();
                    break;
                case "TextOverlay":
                    newOverlay = new TextOverlay();
                    break;
                default:
                    return null;
            }

            newOverlay.owner = owner;
            newOverlay.InitOverlayFromXml(overlay);
            return newOverlay;
        }