Esempio n. 1
0
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="browser">The GEWebBrowser instance</param>
        /// <example>GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
        public void SetBrowserInstance(GEWebBrowser browser)
        {
            this.gewb     = browser;
            this.geplugin = browser.GetPlugin();
            this.Enabled  = true;

            if (this.gewb.PluginIsReady)
            {
                this.Enabled        = true;
                this.timer          = new Timer();
                this.timer.Interval = this.interval;
                this.timer.Start();
                this.timer.Tick += new EventHandler(this.Timer_Tick);

                try
                {
                    this.browserVersionStatusLabel.Text = "ie " + this.gewb.Version.ToString();
                    this.apiVersionStatusLabel.Text     = "api " + this.geplugin.getApiVersion();
                    this.pluginVersionStatusLabel.Text  = "plugin " + this.geplugin.getPluginVersion();
                }
                catch (RuntimeBinderException ex)
                {
                    Debug.WriteLine("SetBrowserInstance: " + ex.ToString(), "StatusStrip");
                    ////throw;
                }
            }
        }
        /// <summary>
        /// Checks if a given element in the tree view needs updating
        /// </summary>
        /// <param name="node">The node to check for</param>
        /// <param name="browser">The browser instance to check in</param>
        /// <returns>a tree view node based on the new data.</returns>
        private static KmlTreeViewNode UpdateCheck(KmlTreeViewNode node, GEWebBrowser browser)
        {
            dynamic liveObject = null;

            try
            {
                liveObject = browser.Plugin.getElementByUrl(node.Name);
            }
            catch (COMException)
            {
            }

            if (liveObject != null)
            {
                KmlTreeViewNode newNode = new KmlTreeViewNode(liveObject)
                {
                    Name = node.Name, BaseUrl = node.BaseUrl
                };

                if (node.Parent != null)
                {
                    // update the tree
                    node.Parent.Nodes.Insert(node.Index, newNode);
                    node.Parent.Nodes.Remove(node);
                }

                return(newNode);
            }

            return(node);
        }
Esempio n. 3
0
 /// <summary>
 /// Set the browser instance for the control to work with
 /// </summary>
 /// <param name="browser">The GEWebBrowser instance</param>
 public void SetBrowserInstance(GEWebBrowser browser)
 {
     this.gewb         = browser;
     this.geplugin     = browser.GetPlugin();
     this.htmlDocument = browser.Document;
     this.Nodes.Clear();
     this.Enabled = true;
 }
Esempio n. 4
0
 /// <summary>
 /// Set the browser instance for the control to work with
 /// </summary>
 /// <param name="browser">The GEWebBrowser instance</param>
 /// <example>GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
 public void SetBrowserInstance(GEWebBrowser browser)
 {
     this.gewb     = browser;
     this.geplugin = browser.GetPlugin();
     if (this.gewb.PluginIsReady)
     {
         this.SynchronizeOptions();
         this.htmlDocument      = browser.Document;
         this.Enabled           = true;
         this.gewb.PluginReady += new GEWebBrowserEventHandler(this.Gewb_PluginReady);
     }
 }
        internal static bool GetInheritedVisibility(this Layer layer, GEWebBrowser browser)
        {
            if (!browser.PluginIsReady)
            {
                return false;
            }

            var target = browser.Plugin.getLayerRoot().getLayerById(layer.GetId());

            if (target == null || !Convert.ToBoolean(target.getVisibility()))
            {
                return false;
            }

            var parent = target.getParentNode();
            return parent != null || GetInheritedVisibility(parent, browser);
        }
Esempio n. 6
0
        internal static bool GetInheritedVisibility(this Layer layer, GEWebBrowser browser)
        {
            if (!browser.PluginIsReady)
            {
                return(false);
            }

            var target = browser.Plugin.getLayerRoot().getLayerById(layer.GetId());

            if (target == null || !Convert.ToBoolean(target.getVisibility()))
            {
                return(false);
            }

            var parent = target.getParentNode();

            return(parent != null || GetInheritedVisibility(parent, browser));
        }
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (!GEHelpers.IsGE(this.browser.Plugin))
            {
                throw new ArgumentException("ge is not of the type GEPlugin");
            }

            this.Nodes.Clear();
            this.Enabled    = true;
            this.CheckBoxes = true;

            this.browser.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "PluginIsReady")
                {
                    this.Enabled = this.browser.PluginIsReady;
                }
            };
        }
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (!this.browser.PluginIsReady)
            {
                return;
            }

            this.Enabled = true;
            this.ShowStatusLabels(true);

            this.browser.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName != "PluginIsReady")
                {
                    return;
                }

                this.ShowStatusLabels(this.browser.PluginIsReady);
            };
        }
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        /// <example>Example: GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (!this.browser.PluginIsReady)
            {
                return;
            }

            this.Enabled = true;
            this.options = new GEOptions(this.browser.Plugin);
            this.control = new GENavigationControl(this.browser.Plugin);
            this.SynchronizeOptions();

            this.browser.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "PluginIsReady")
                {
                    this.Enabled = this.browser.PluginIsReady;
                }
            };
        }
Esempio n. 10
0
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        /// <example>Example: GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (this.browser.PluginIsReady)
            {
                this.Enabled = true;
                timer = new Timer();
                timer.Interval = this.interval;
                timer.Start();
                timer.Tick += new EventHandler(this.Timer_Tick);

                this.browser.PluginReady += (o, e) => this.Enabled = true;
                this.FindForm().FormClosing += (o, e) => timer.Stop();

                try
                {
                    this.browserVersionStatusLabel.Text = "ie " + this.browser.Version.ToString();
                    this.apiVersionStatusLabel.Text = "api " + this.browser.Plugin.getApiVersion();
                    this.pluginVersionStatusLabel.Text = "plugin " + this.browser.Plugin.getPluginVersion();
                }
                catch (RuntimeBinderException rbex)
                {
                    Debug.WriteLine("SetBrowserInstance: " + rbex.Message, "StatusStrip");
                }
            }
        }
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        /// <example>Example: GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (!this.browser.PluginIsReady)
            {
                return;
            }

            this.Enabled = true;
            this.options = new GEOptions(this.browser.Plugin);
            this.control = new GENavigationControl(this.browser.Plugin);
            this.SynchronizeOptions();

            this.browser.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "PluginIsReady")
                {
                    this.Enabled = this.browser.PluginIsReady;
                }
            };
        }
Esempio n. 12
0
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (!GEHelpers.IsGE(this.browser.Plugin))
            {
                throw new ArgumentException("ge is not of the type GEPlugin");
            }

            this.Nodes.Clear();
            this.Enabled = true;
            this.CheckBoxes = true;

            this.browser.PluginReady += (o, e) =>
            {
                this.Enabled = true;
            };
        }
Esempio n. 13
0
 /// <summary>
 /// Set the browser instance for the control to work with
 /// </summary>
 /// <param name="browser">The GEWebBrowser instance</param>
 /// <example>GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
 public void SetBrowserInstance(GEWebBrowser browser)
 {
     this.gewb = browser;
     this.geplugin = browser.GetPlugin();
     if (this.gewb.PluginIsReady)
     {
         this.SynchronizeOptions();
         this.htmlDocument = browser.Document;
         this.Enabled = true;
         this.gewb.PluginReady += new GEWebBrowserEventHandler(this.Gewb_PluginReady);
     }
 }
        /// <summary>
        /// Checks if a given element in the tree view needs updating
        /// </summary>
        /// <param name="node">The node to check for</param>
        /// <param name="browser">The browser instance to check in</param>
        /// <returns>a tree view node based on the new data.</returns>
        private static KmlTreeViewNode UpdateCheck(KmlTreeViewNode node, GEWebBrowser browser)
        {
            dynamic liveObject = null;

            try
            {
                liveObject = browser.Plugin.getElementByUrl(node.Name);
            }
            catch (COMException)
            {
            }

            if (liveObject != null)
            {
                KmlTreeViewNode newNode = new KmlTreeViewNode(liveObject) { Name = node.Name, BaseUrl = node.BaseUrl };

                if (node.Parent != null)
                {
                    // update the tree
                    node.Parent.Nodes.Insert(node.Index, newNode);
                    node.Parent.Nodes.Remove(node);
                }

                return newNode;
            }

            return node;
        }
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;
  
            if (!GEHelpers.IsGE(this.browser.Plugin))
            {
                throw new ArgumentException("ge is not of the type GEPlugin");
            }

            this.Nodes.Clear();
            this.Enabled = true;
            this.CheckBoxes = true;

            this.browser.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "PluginIsReady")
                {
                    this.Enabled = this.browser.PluginIsReady;
                }
            };
        }
Esempio n. 16
0
        /// <summary>
        /// Look at the given geometry 
        /// </summary>
        /// <param name="ge">the plugin</param>
        /// <param name="feature">the geomerty to look at</param>
        /// <param name="browser">A instance of the GEWebBrowser object</param>
        /// <returns>true on success</returns>
        public static bool LookAt(dynamic ge, dynamic feature, GEWebBrowser browser)
        {
            dynamic abstractView = null;

            if (null != ge && null != feature)
            {
                string type = feature.getType();

                try
                {
                    switch (type)
                    {
                        case "KmlFolder":
                        case "KmlDocument":
                            if (null != feature.getAbstractView())
                            {
                                abstractView = feature.getAbstractView();
                            }

                            break;
                        case "KmlNetworkLink":
                            if (null != feature.getAbstractView())
                            {
                                abstractView = feature.getAbstractView();
                            }
                            else
                            {
                                if (null != browser)
                                {
                                    string linkUrl = string.Empty;

                                    // Kml documents using the pre 2.1 spec may contain the <Url> element
                                    // in these cases the getHref call will return null
                                    try
                                    {
                                        linkUrl = feature.getLink().getHref();
                                    }
                                    catch (NullReferenceException)
                                    {
                                        linkUrl = feature.GetUrl();
                                    }

                                    dynamic kmlObject = browser.FetchKmlSynchronous(linkUrl);

                                    if (null != kmlObject)
                                    {
                                        if (kmlObject.getOwnerDocument() != null)
                                        {
                                            abstractView = kmlObject.getOwnerDocument().getAbstractView();
                                        }
                                    }
                                }
                            }

                            break;
                        case "KmlPoint":
                            return LookAt(ge, feature.getLatitude(), feature.getLongitude());
                        case "KmlPolygon":
                            return LookAt(
                                ge,
                                feature.getOuterBoundary().getCoordinates().get(0).getLatitude(),
                                feature.getOuterBoundary().getCoordinates().get(0).getLongitude());
                        case "KmlPlacemark":
                            if (null != feature.getAbstractView())
                            {
                                abstractView = feature.getAbstractView();
                            }
                            else
                            {
                                return LookAt(ge, feature.getGeometry(), browser);
                            }

                            break;
                        case "KmlLineString":
                            return LookAt(
                                ge,
                                feature.getCoordinates().get(0).getLatitude(),
                                feature.getCoordinates().get(0).getLongitude());
                        case "KmlMultiGeometry":
                            ////IKmlMultiGeometry multiGeometry = (IKmlMultiGeometry)geometry;
                            ////multiGeometry.getGeometries().getFirstChild().getType();
                            return false;
                        default:
                            return false;
                    }

                    if (null != abstractView)
                    {
                        ge.getView().setAbstractView(abstractView);
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (RuntimeBinderException ex)
                {
                    Debug.WriteLine("LookAt: " + ex.ToString());
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Set the browser instance for the control to work with
 /// </summary>
 /// <param name="browser">The GEWebBrowser instance</param>
 public void SetBrowserInstance(GEWebBrowser browser)
 {
     this.gewb = browser;
     this.geplugin = browser.GetPlugin();
     this.htmlDocument = browser.Document;
     this.Nodes.Clear();
     this.Enabled = true;
 }
Esempio n. 18
0
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="browser">The GEWebBrowser instance</param>
        /// <example>GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
        public void SetBrowserInstance(GEWebBrowser browser)
        {
            this.gewb = browser;
            this.geplugin = browser.GetPlugin();
            this.Enabled = true;

            if (this.gewb.PluginIsReady)
            {
                this.Enabled = true;
                this.timer = new Timer();
                this.timer.Interval = this.interval;
                this.timer.Start();
                this.timer.Tick += new EventHandler(this.Timer_Tick);

                try
                {
                    this.browserVersionStatusLabel.Text = "ie " + this.gewb.Version.ToString();
                    this.apiVersionStatusLabel.Text = "api " + this.geplugin.getApiVersion();
                    this.pluginVersionStatusLabel.Text = "plugin " + this.geplugin.getPluginVersion();
                }
                catch (RuntimeBinderException ex)
                {
                    Debug.WriteLine("SetBrowserInstance: " + ex.ToString(), "StatusStrip");
                    ////throw;
                }
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Set the browser instance for the control to work with
        /// </summary>
        /// <param name="instance">The GEWebBrowser instance</param>
        /// <example>Example: GEToolStrip.SetBrowserInstance(GEWebBrowser)</example>
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (this.browser.PluginIsReady)
            {
                this.options = new GEOptions(this.browser.Plugin);
                this.control = new GENavigationControl(this.browser.Plugin);
                this.SynchronizeOptions();
                this.Enabled = true;
            }
        }
        public RidingModelFeature(GEWebBrowser geWebBrowser, List<GeoCoordinate> fullPath)
        {
            this.geWebBrowser = geWebBrowser;
            this.ge = geWebBrowser.Plugin as IGEPlugin;
            this.fullPath = fullPath;

            LoadTrainModel();
        }
Esempio n. 21
0
        /// <summary>
        /// Look at the given geometry
        /// </summary>
        /// <param name="ge">the plugin</param>
        /// <param name="feature">the geomerty to look at</param>
        /// <param name="browser">A instance of the GEWebBrowser object</param>
        /// <returns>true on success</returns>
        public static bool LookAt(dynamic ge, dynamic feature, GEWebBrowser browser)
        {
            dynamic abstractView = null;

            if (null != ge && null != feature)
            {
                string type = feature.getType();

                try
                {
                    switch (type)
                    {
                    case "KmlFolder":
                    case "KmlDocument":
                        if (null != feature.getAbstractView())
                        {
                            abstractView = feature.getAbstractView();
                        }

                        break;

                    case "KmlNetworkLink":
                        if (null != feature.getAbstractView())
                        {
                            abstractView = feature.getAbstractView();
                        }
                        else
                        {
                            if (null != browser)
                            {
                                string linkUrl = string.Empty;

                                // Kml documents using the pre 2.1 spec may contain the <Url> element
                                // in these cases the getHref call will return null
                                try
                                {
                                    linkUrl = feature.getLink().getHref();
                                }
                                catch (NullReferenceException)
                                {
                                    linkUrl = feature.GetUrl();
                                }

                                dynamic kmlObject = browser.FetchKmlSynchronous(linkUrl);

                                if (null != kmlObject)
                                {
                                    if (kmlObject.getOwnerDocument() != null)
                                    {
                                        abstractView = kmlObject.getOwnerDocument().getAbstractView();
                                    }
                                }
                            }
                        }

                        break;

                    case "KmlPoint":
                        return(LookAt(ge, feature.getLatitude(), feature.getLongitude()));

                    case "KmlPolygon":
                        return(LookAt(
                                   ge,
                                   feature.getOuterBoundary().getCoordinates().get(0).getLatitude(),
                                   feature.getOuterBoundary().getCoordinates().get(0).getLongitude()));

                    case "KmlPlacemark":
                        if (null != feature.getAbstractView())
                        {
                            abstractView = feature.getAbstractView();
                        }
                        else
                        {
                            return(LookAt(ge, feature.getGeometry(), browser));
                        }

                        break;

                    case "KmlLineString":
                        return(LookAt(
                                   ge,
                                   feature.getCoordinates().get(0).getLatitude(),
                                   feature.getCoordinates().get(0).getLongitude()));

                    case "KmlMultiGeometry":
                        ////IKmlMultiGeometry multiGeometry = (IKmlMultiGeometry)geometry;
                        ////multiGeometry.getGeometries().getFirstChild().getType();
                        return(false);

                    default:
                        return(false);
                    }

                    if (null != abstractView)
                    {
                        ge.getView().setAbstractView(abstractView);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (RuntimeBinderException ex)
                {
                    Debug.WriteLine("LookAt: " + ex.ToString());
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        public void SetBrowserInstance(GEWebBrowser instance)
        {
            this.browser = instance;

            if (!this.browser.PluginIsReady)
            {
                return;
            }

            this.Enabled = true;
            this.ShowStatusLabels(true);

            this.browser.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName != "PluginIsReady")
                {
                    return;
                }

                this.ShowStatusLabels(this.browser.PluginIsReady);
            };
        }