Example #1
0
        public void CreateUmbrielPropertySetTest()
        {
            IPropertySet actual;

            actual = LayerExtHelper.CreateUmbrielPropertySet();
            Assert.IsNotNull(actual);
        }
Example #2
0
        public void ToDataTableTest()
        {
            IPropertySet propertySet = Umbriel.ArcGIS.Layer.Util.LayerExtHelper.CreateUmbrielPropertySet();

            DataTable actual;

            actual = LayerExtHelper.ToDataTable(propertySet);
            Assert.IsTrue(actual.Rows.Count > 0);
        }
Example #3
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            if (m_hookHelper != null)
            {
                try
                {
                    IApplication appArcMap = (IApplication)m_hookHelper.Hook;
                    IMxDocument  doc       = (IMxDocument)appArcMap.Document;

                    if (doc.SelectedLayer != null)
                    {
                        ILayer       layer       = doc.SelectedLayer;
                        IPropertySet propertySet = null;

                        bool newPropertySet = false;

                        ILayerExtensions layerExtensions = (ILayerExtensions)layer;

                        Trace.WriteLine(layerExtensions.ExtensionCount.ToString());

                        List <IPropertySet> psets = layer.FindExtensionPropertySet("layerextension", "umbriel");



                        if (!LayerExtHelper.UmbrielPropertySetExists(layerExtensions))
                        {
                            propertySet    = LayerExtHelper.CreateUmbrielPropertySet();
                            newPropertySet = true;
                        }
                        else
                        {
                            propertySet = LayerExtHelper.GetUmbrielPropertySet(layerExtensions);
                        }

                        if (propertySet != null)
                        {
                            if (this.propertySetForm == null)
                            {
                                this.propertySetForm = new CustomLayerPropertiesForm(propertySet);
                            }

                            DialogResult res = this.propertySetForm.ShowDialog();

                            if (res == DialogResult.OK)
                            {
                                if (this.propertySetForm.PropertySet != null)
                                {
                                    LayerExtHelper.RemovePropertySet(layerExtensions);
                                    layerExtensions.AddExtension(this.propertySetForm.PropertySet);
                                }
                            }

                            this.propertySetForm.Dispose();
                            this.propertySetForm = null;
                        }
                    }
                    else
                    {
                        MessageBox.Show("No layer highlighted in the table of contents.", "Ooops.", MessageBoxButtons.OK);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Umbriel Custom Layer Properties Error", System.Windows.Forms.MessageBoxButtons.OK);
                }
            }
            else if (m_sceneHookHelper != null)
            {
                throw new NotImplementedException();
            }
            else if (m_globeHookHelper != null)
            {
                throw new NotImplementedException();
            }
        }