예제 #1
0
        private void EntityTranslationForm_Shown(object sender, EventArgs e)
        {
            unknownTextBox.Text = m_Alias;

            IEntity[] ents = EnvironmentContainer.EntityTypes(m_Type);
            listBox.Items.AddRange(ents);
        }
예제 #2
0
        /// <summary>
        /// Loads this combo with entity types relating to a specific
        /// editing layer, sorting the list by entity type name.
        /// </summary>
        /// <param name="type">The spatial type(s) of interest</param>
        /// <param name="layer">The layer of interest</param>
        /// <returns>The default entity type in the combo (if any)</returns>
        public IEntity Load(SpatialType type, ILayer layer)
        {
            IEntity[] entities = EnvironmentContainer.EntityTypes(type, layer);
            Array.Sort <IEntity>(entities, delegate(IEntity a, IEntity b)
                                 { return(a.Name.CompareTo(b.Name)); });

            // If we're not supposed to show blank entities, weed them out
            if (!m_ShowBlankEntityType)
            {
                entities = Array.FindAll(entities, e => e.Name.Length > 0);
            }

            this.DataSource = entities;

            //IEntity ent = EnvironmentContainer.GetDefaultEntity(type, layer);
            IEntity ent = CadastralMapModel.Current.GetDefaultEntity(type);

            if (ent == null)
            {
                return(null);
            }

            // The objects representing the default may be in a different address
            // space, so ensure we return the item from the combo.
            ent = Array.Find <IEntity>(entities, e => (e.Name == ent.Name));
            this.SelectedItem = ent;
            return(ent);
        }
예제 #3
0
        private void GetEntityForm_Shown(object sender, EventArgs e)
        {
            // Display appropriate form title
            if (m_Type == SpatialType.Point)
            {
                this.Text = "Entity type for points";
            }
            else if (m_Type == SpatialType.Line)
            {
                this.Text = "Entity type for lines";
            }
            else if (m_Type == SpatialType.Polygon)
            {
                this.Text = "Entity type for area labels";
            }
            else if (m_Type == SpatialType.Text)
            {
                this.Text = "Entity type for text";
            }
            else
            {
                this.Text = "Specify entity type";
            }

            // Load the entity types for the spatial data type
            IEntity[] ents = EnvironmentContainer.EntityTypes(m_Type, m_Layer);
            listBox.Items.AddRange(ents);

            // Remove first item if it's blank
            if (listBox.Items.Count > 0 && listBox.Items[0].ToString().Length == 0)
            {
                listBox.Items.RemoveAt(0);
            }

            // Select the current default for the layer
            IEntity defEnt = GetListDefault();

            listBox.SelectedItem = defEnt;

            // The polygon boundary checkbox should only be visible for lines
            // (and should be checked if the default entity type is topological).
            polBoundaryCheckBox.Visible = (m_Type == SpatialType.Line);
            if (polBoundaryCheckBox.Visible && defEnt != null)
            {
                polBoundaryCheckBox.Checked = defEnt.IsPolygonBoundaryValid;
            }
        }
예제 #4
0
        private void NewPointForm_Load(object sender, EventArgs e)
        {
            // Display alternate window title if one has been supplied.
            if (!String.IsNullOrEmpty(m_Title))
            {
                this.Text = m_Title;
            }

            ILayer layer = m_Cmd.ActiveLayer;

            IEntity[] entities = EnvironmentContainer.EntityTypes(SpatialType.Point, layer);
            Array.Sort <IEntity>(entities, delegate(IEntity a, IEntity b) { return(a.Name.CompareTo(b.Name)); });
            entityTypeComboBox.DataSource = entities;

            // If it's not an update ...
            if (!InitUpdate())
            {
                m_PointId = new IdHandle();

                // Pick any default entity type (the change handler for the entity type combo will go on to load the ID combo)
                IEntity defEnt = CadastralMapModel.Current.DefaultPointType;
                if (defEnt != null)
                {
                    entityTypeComboBox.SelectedItem = defEnt;

                    // If we are auto-numbering, disable the ID combo.
                    if (EditingController.Current.IsAutoNumber)
                    {
                        idComboBox.Enabled = false;
                    }
                }
                else
                {
                    idComboBox.Enabled = false;
                }



                // If the position is defined (because we're recalling
                // a previous command), fill in those fields too.

                if (Math.Abs(m_Position.X) > Double.Epsilon && Math.Abs(m_Position.Y) > Double.Epsilon)
                {
                    ShowPosition();
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AcLayerEntitySet"/> class.
        /// </summary>
        internal AcLayerEntitySet()
        {
            m_EntityToLayer = new Dictionary <string, string>();
            m_Entities      = new Dictionary <string, IEntity>();
            m_Layers        = new Dictionary <string, Layer>();

            // Grab the entity types that relate to the active editing layer
            ILayer mapLayer = EditingController.Current.ActiveLayer;

            IEntity[] entities = EnvironmentContainer.EntityTypes(SpatialType.All, mapLayer);

            // Initialize entity type -> AC layer name (without any translation), as
            // well as entity name -> entity type index.
            foreach (IEntity e in entities)
            {
                m_EntityToLayer[e.Name] = e.Name;
                m_Entities[e.Name]      = e;
            }

            // Grab any suffixes to append to AC layer names
            m_PinLayerSuffix   = GetLayerSuffix("CED_PIN_LAYER_SUFFIX");
            m_DistLayerSuffix  = GetLayerSuffix("CED_DIST_LAYER_SUFFIX");
            m_AngleLayerSuffix = GetLayerSuffix("CED_ANGLE_LAYER_SUFFIX");
        }