/*
         * Constructor for Google Maps API utilities
         */
        public GoogleMapsEngineAPI(ref log4net.ILog log)
        {
            // establish the Google APIs project key
            this.GOOGLE_API_KEY = Properties.Settings.Default.gme_api_key;

            // establish the Google Maps Engine API settings
            this.GME_API_PROTOCOL = Properties.Settings.Default.gme_api_protocol;
            this.GME_API_DOMAIN   = Properties.Settings.Default.gme_api_domain;
            this.GME_API_SERVICE  = Properties.Settings.Default.gme_api_service;
            this.GME_API_VERSION  = Properties.Settings.Default.gme_api_version;

            // set the log
            this.log = log;

            // retrieve a reference to the extension
            log.Debug("Retrieiving a reference to the extension object.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // create a Google Maps Engine Session Id for this set of sessions
            GoogleMapsEngineAPISessionId = Guid.NewGuid();

            // if debug, create a debug folder to keep track of information
            if (log.IsDebugEnabled)
            {
                // create a temporary folder
                debugDirectory = System.IO.Directory.CreateDirectory(
                    ext.getLocalWorkspaceDirectory()
                    + "\\GME_API_TMP_"
                    + GoogleMapsEngineAPISessionId.ToString().Replace("-", ""));
            }
        }
        /*
         * Constructor for the Directory Listing form
         */
        public GoogleMapsEngineDirectoryListing()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("GoogleMapsEngineDirectoryListing initializing.");

            // retrieve a reference to the extension
            log.Debug("Retrieiving a reference to the extension object.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // initialize the form objects
            log.Debug("Initializing the form objects.");
            InitializeComponent();

            // bind the buttons on the form to Resources for localization capabilities
            log.Debug("Binding the buttons to Resources.");
            this.btnSearch.Text = Properties.Resources.dialog_GoogleMapsEngineDirectoryListing_btnSearch_Text;
            this.btnAdd.Text    = Properties.Resources.dialog_GoogleMapsEngineDirectoryListing_btnAdd_Text;
            this.btnCancel.Text = Properties.Resources.dialog_GoogleMapsEngineDirectoryListing_btnCancel_Text;

            // bind the search template to the Resources for localization capabilities
            log.Debug("Binding the search text template to Resources.");
            this.txtSearchSummaryTemplate = Properties.Resources.dialog_GoogleMapsEngineDirectoryListing_txtSearchSummaryTemplate;
        }
        public ToolsCommand_FindAsset()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("ToolsCommand_FindAsset initializing.");

            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // check to see if the extension is enabled
            log.Debug("Verifying extension is enabled.");
            if (!ext.isExtensionEnabled())
            {
                this.Enabled = false;
            }
            else
            {
                if (!ext.isAuthorizationAvailable())
                {
                    this.Enabled = false;
                }
            }

            // subscribe to extension state change events through the extension
            ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange;

            // subscribe to Authentication state change events through the extension
            ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent;
        }
        public ToolsCommand_UploadToGoogleMapsEngine()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("ToolsCommand_UploadToGoogleEarthBuilder initializing.");

            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // check to see if the extension is enabled
            log.Debug("Verifying extension is enabled.");
            if (ext.isExtensionEnabled())
            {
                // the extension is enabled, verify the button is also enabled
                log.Debug("Extension is enabled, enable button and check to verify the user has an auth token.");
                this.Enabled = true;

                // check to see if the user has an auth code
                log.Debug("Checking to see if the user has an OAuth code");
                if (ext.isAuthorizationAvailable() && !ext.getToken().isViewOnly &&
                    ext.hasAtLeastOneLayer())
                {
                    // the user has an OAuth code available for use
                    log.Debug("User has an OAuth code available. Check the button.");
                    this.Enabled = true;
                }
                else
                {
                    // the user does not have an OAuth code available for use
                    log.Debug("User does not have an OAuth code available. Uncheck the button.");
                    this.Enabled = false;
                }
            }
            else
            {
                // disable this button
                log.Debug("The extension is disabled, disable this button.");
                this.Enabled = false;
            }

            // subscribe to extension state change events through the extension
            ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange;

            // subscribe to Authentication state change events through the extension
            ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent;

            // subscribe to map layer selection change events through the extension
            ext.RaiseMapLayerStateChangeEvent += HandleMapLayerSelectionStateChangeEvent;
        }
Example #5
0
        protected override void OnClick()
        {
            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            GoogleMapsEngineToolsExtensionForArcGIS ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // check to see if the extension is enabled
            log.Debug("Verifying extension is enabled.");
            if (ext.isExtensionEnabled())
            {
                Extension.Dialogs.Settings.Preferences preferencesForm = new Extension.Dialogs.Settings.Preferences();
                preferencesForm.Show();
            }
        }
        public ProgressDialog()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("ProgressDialog initializing.");

            // retrieve a reference to the extension
            log.Debug("Retrieiving a reference to the extension object.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            InitializeComponent();

            // subscribe to Download Progress state change events through the extension
            ext.RaiseDownloadProgressChangeEvent += HandleDownloadProgressStateChangeEvent;
        }
Example #7
0
        private void About_Load(object sender, EventArgs e)
        {
            try
            {
                // to check the state of the extension, get the extension
                log.Debug("Retrieving a reference to the extension object to check state.");
                GoogleMapsEngineToolsExtensionForArcGIS ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

                // fetch the about_dialog_html resource
                log.Debug("fetch the about_dialog_html resource");
                string buildinfotxt = Properties.Resources.about_dialog_html;

                // replace, if exists, the {addinname}
                log.Debug("replace, if exists, the {addinname}");
                buildinfotxt = buildinfotxt.Replace("{addinname}", ext.getAddinName());

                // replace, if exists, the {addindescription}
                log.Debug("replace, if exists, the {addindescription}");
                buildinfotxt = buildinfotxt.Replace("{addindescription}", ext.getAddinDescription());

                // replace, if exists, the {addindate}
                log.Debug("replace, if exists, the {addindate}");
                buildinfotxt = buildinfotxt.Replace("{addindate}", ext.getAddinDate());

                // replace, if exists, the {addinbuildversion}
                log.Debug("replace, if exists, the {addinbuildversion}");
                buildinfotxt = buildinfotxt.Replace("{addinbuildversion}", ext.getAddinVersion());

                // replace, if exists, the {assemblyversion}
                log.Debug("replace, if exists, the {assemblyversion}");
                buildinfotxt = buildinfotxt.Replace("{assemblyversion}", Assembly.GetExecutingAssembly().GetName().Version.ToString());

                // set the build information
                log.Debug("Setting the HTML to the web browser on the dialog.");
                this.wblegal.DocumentText = buildinfotxt;

                // add a script manager to the browser
                // in order to capture select events
                this.wblegal.ObjectForScripting = new BrowerScriptManager(this);
            }
            catch (System.Exception ex)
            {
                // an error occured, log and write standard text
                log.Error(ex);
                this.wblegal.DocumentText = "Google Maps Engine Add-in for ArcGIS Desktop.";
            }
        }
        // the constructor for the Feature Class Management class
        public GoogleMapsEngineFeatureClassManagement(MapsEngine.API.GoogleMapsEngineAPI api)
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("GoogleMapsEngineFeatureClassManagement initializing.");

            // retrieve a reference to the extension
            log.Debug("Retrieiving a reference to the extension object.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // initiate the Google Maps Enigne API object
            log.Debug("Setting the GME API object.");
            this.api = api;

            // generate a worldwide polygon, for default (spatial geometry undetermined or undefined) assets
            log.Debug("Establishing a default worldwide polygon object.");
            IPoint pUL = new Point();

            pUL.X = -180;
            pUL.Y = 90;
            IPoint pLL = new Point();

            pLL.X = -180;
            pLL.Y = -90;
            IPoint pLR = new Point();

            pLR.X = 180;
            pLR.Y = -90;
            IPoint pUR = new Point();

            pUR.X = 180;
            pUR.Y = 90;

            // add the points to the point collection
            IPointCollection pPtColl = new Polygon();

            pPtColl.AddPoint(pUL, Type.Missing, Type.Missing);
            pPtColl.AddPoint(pUR, Type.Missing, Type.Missing);
            pPtColl.AddPoint(pLR, Type.Missing, Type.Missing);
            pPtColl.AddPoint(pLL, Type.Missing, Type.Missing);
            pPtColl.AddPoint(pUL, Type.Missing, Type.Missing);

            // define the polygon as a list of points, then close the polygon
            worldPolygon = (IPolygon)pPtColl;
            worldPolygon.Close();
        }
        public ToolsCommand_ViewInMapsEngine()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("ToolsCommand_ViewInEarthBuilder initializing.");

            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // this button will always be disabled, until a selection is made
            log.Debug("Disable button until selection is made, at which time check extension and auth.");
            this.Enabled = false;

            // subscribe to selection change events events through the extension
            ext.RaiseSelectionChangeEvent += HandleSelectionChange;
        }
        protected override void OnClick()
        {
            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            GoogleMapsEngineToolsExtensionForArcGIS ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // check to see if the extension is enabled
            log.Debug("Verifying extension is enabled.");
            if (ext.isExtensionEnabled())
            {
                // initialize the About form
                log.Info("Initializing dialogs.settings.About and showing it.");
                Extension.Dialogs.Settings.About aboutForm = new Extension.Dialogs.Settings.About();

                // make the about form visible
                aboutForm.Show();
            }
        }
Example #11
0
        public ToolsCommand_UserSignout()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("ToolsCommand_UserSignout initializing.");

            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // check to see if the extension is enabled
            log.Debug("Verifying extension is enabled.");
            if (!ext.isExtensionEnabled())
            {
                // the extension is not enabled, diable the button
                log.Debug("Disabling the sign-out button, as the extension is disabled.");
                this.Enabled = false;
            }
            else
            {
                // by default, if there is no auth object, disable sign-out
                log.Debug("Extension enabled, checking to see if there is a valid auth token.");
                if (ext.isAuthorizationAvailable())
                {
                    // there is an auth token, verify the button is enabled
                    log.Debug("The auth token is available, setting the button to enabled.");
                    this.Enabled = true;
                }
                else
                {
                    // there is no auth token, setting the button to disabled
                    log.Debug("The auth token isn't available, disabling the sign-out button.");
                    this.Enabled = false;
                }
            }

            // subscribe to extension state change events through the extension
            ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange;

            // subscribe to Authentication state change events through the extension
            ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent;
        }
        public Preferences()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("Preferences initializing.");

            // retrieve a reference to the extension
            log.Debug("Retrieiving a reference to the extension object.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // initialize the preference components
            InitializeComponent();

            // populate the UI fields
            populate();

            // subscribe to Authentication state change events through the extension
            ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent;
        }
        protected override void OnClick()
        {
            try
            {
                // to check the state of the extension, get the extension
                log.Info("Retrieving a reference to the extension object to check state.");
                GoogleMapsEngineToolsExtensionForArcGIS ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

                // check to see if the extension is enabled
                log.Debug("Verifying extension is enabled.");
                if (ext.isExtensionEnabled())
                {
                    // create an update check object
                    log.Debug("Creating an update check object.");
                    Extension.Update.ExtensionUpdateCheck updateCheck = new Extension.Update.ExtensionUpdateCheck();

                    // check to see if there is an update available
                    log.Debug("Checking to see if there is an update available.");
                    if (updateCheck.isUpdateAvailable())
                    {
                        log.Debug("isUpdateAvailable = true");

                        // create a dialog to inform the user of an update
                        log.Debug("Showing the user an OK/Cancel dialog to notify them of an update.");
                        if (System.Windows.Forms.MessageBox.Show("An update to the Google Maps Engine Tools for ArcGIS is avaiable.  Would you like to update the Add-in now?"
                                                                 , "Update Available (" + updateCheck.getLocalVersion().ToString() + " < " + updateCheck.getServerVersion().ToString() + ")"
                                                                 , System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                        {
                            // launch browser at the URL provided in the update check
                            log.Debug("Launching the browser to the update URL, as the user selected OK.");
                            System.Diagnostics.Process.Start(updateCheck.getUpdateURI());
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                // an error occured
                log.Error(ex);
            }
        }
Example #14
0
        public ToolsCommand_UploadToGoogleMapsEngine()
        {
            // initialize and configure log4net, reading from Xml .config file
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

            log.Info("ToolsCommand_UploadToGoogleMapsEngine initializing.");

            // to check the state of the extension, get the extension
            log.Info("Retrieving a reference to the extension object to check state.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // Verify the button is also disabled by default
            log.Debug("Disable button by default.");
            this.Enabled = false;

            // subscribe to extension state change events through the extension
            ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange;

            // subscribe to Authentication state change events through the extension
            ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent;

            // subscribe to map layer selection change events through the extension
            ext.RaiseMapLayerStateChangeEvent += HandleMapLayerSelectionStateChangeEvent;
        }