Exemple #1
0
        public AttributesProperty(IGeoObject o, IFrame frame)
        {
            IColorDef clr = o as IColorDef;

            if (clr != null)
            {
                colorSelectProp = new ColorSelectionProperty(o, "ColorDef", "GeoObject.Color", frame.Project.ColorList, ColorList.StaticFlags.allowAll);
            }
            layerSelectProp = new LayerSelectionProperty(o, StringTable.GetString("GeoObject.Layer"), frame.Project.LayerList);
            resourceId      = "GeoObject.Attributes";
        }
Exemple #2
0
        public bool isChangingMultipleAttributes;                    // es werden gerade Attribute der Objekte geändert
        public MultiObjectsProperties(IFrame frame, GeoObjectList selectedObjects)
        {
            this.selectedObjects = selectedObjects;
            this.frame           = frame;

            attributeProperties = new SimplePropertyGroup("Select.Attributes");

            if (objectCount == null)
            {
                objectCount          = new IntegerProperty(selectedObjects.Count, "Select.NumObjects");
                objectCount.ReadOnly = true;
            }
            attributeProperties.Add(objectCount);

            if (multiLinePattern == null)
            {   // nur einmal erzeugen, steht halt dumm rum, wenn nur ein Objekt markiert ist
                multiLinePattern = new LinePatternSelectionProperty("Select.LinePattern", frame.Project.LinePatternList, null);
                multiLinePattern.LinePatternChangedEvent += new CADability.UserInterface.LinePatternSelectionProperty.LinePatternChangedDelegate(OnMultiLinePatternSelectionChanged);
                multiLinePattern.SetUnselectedText("Select.MultipleLinePattern");
            }
            attributeProperties.Add(multiLinePattern);

            if (multiLineWidth == null)
            {   // nur einmal erzeugen, steht halt dumm rum, wenn nur ein Objekt markiert ist
                multiLineWidth = new LineWidthSelectionProperty("Select.LineWidth", frame.Project.LineWidthList, null);
                multiLineWidth.LineWidthChangedEvent += new CADability.UserInterface.LineWidthSelectionProperty.LineWidthChangedDelegate(OnMultiLineWidthSelectionChanged);
                multiLineWidth.SetUnselectedText("Select.MultipleLineWidth");
            }
            attributeProperties.Add(multiLineWidth);

            if (multiLayer == null)
            {   // nur einmal erzeugen, steht halt dumm rum, wenn nur ein Objekt markiert ist
                multiLayer = new LayerSelectionProperty("Select.Layer", frame.Project.LayerList, null);
                multiLayer.LayerChangedEvent += new CADability.Attribute.LayerSelectionProperty.LayerChangedDelegate(OnMultiLayerSelectionChanged);
                multiLayer.SetUnselectedText("Select.MultipleLayer");
            }
            attributeProperties.Add(multiLayer);

            if (multiColorDef == null)
            {   // nur einmal erzeugen, steht halt dumm rum, wenn nur ein Objekt markiert ist
                multiColorDef = new ColorSelectionProperty("Select.ColorDef", frame.Project.ColorList, null, ColorList.StaticFlags.allowNone);
                multiColorDef.ColorDefChangedEvent += new ColorSelectionProperty.ColorDefChangedDelegate(OnMultiColorDefSelectionChanged);
                multiColorDef.SetUnselectedText("Select.MultipleColorDef");
            }
            attributeProperties.Add(multiColorDef);

            if (multiStyle == null)
            {   // nur einmal erzeugen, steht halt dumm rum, wenn nur ein Objekt markiert ist
                multiStyle = new StyleSelectionProperty(null, "Select.Style", frame.Project.StyleList);
                multiStyle.StyleChangedEvent += new StyleSelectionProperty.StyleChangedDelegate(OnMultiStyleChanged);
                multiStyle.SetUnselectedText("Select.MultipleColorDef");
            }
            attributeProperties.Add(multiStyle);

            // gemeinsame custom Attribute sammeln und zufügen
            multiAttributes = new Dictionary <string, IPropertyEntry>();
            for (int i = 0; i < selectedObjects.Count; ++i)
            {
                string[] nasp = selectedObjects[i].CustomAttributeKeys; // hierrüber den Punkt nach dem Symbol fragen
                for (int j = 0; j < nasp.Length; ++j)
                {
                    if (!multiAttributes.ContainsKey(nasp[j]))
                    {   // es wird nur einmal erzeugt
                        string         key = nasp[j];
                        IPropertyEntry ina = selectedObjects[i].GetNamedAttribute(key).GetSelectionProperty(key, frame.Project, selectedObjects);
                        if (ina != null)
                        {
                            multiAttributes[key] = ina;
                        }
                    }
                }
            }
            foreach (IPropertyEntry sp in multiAttributes.Values)
            {
                attributeProperties.Add(sp);
            }

            // gemeinsame Userdata mit IMultiObjectUserData interface sammeln und zufügen
            multiUserData = new Dictionary <string, IPropertyEntry>();
            for (int i = 0; i < selectedObjects.Count; ++i)
            {
                string[] na = selectedObjects[i].UserData.AllItems;
                for (int j = 0; j < na.Length; ++j)
                {
                    object data = selectedObjects[i].UserData.GetData(na[j]);
                    if (data is IMultiObjectUserData && !multiUserData.ContainsKey(na[j]))
                    {   // es wird nur einmal erzeugt
                        string key = na[j];
                        multiUserData[key] = (data as IMultiObjectUserData).GetShowProperty(selectedObjects);
                    }
                }
            }
            foreach (IPropertyEntry sp in multiUserData.Values)
            {
                attributeProperties.Add(sp);
            }

            InitMultiAttributeSelection();
        }