public void AddNewUniqueValue(object newValue, FieldType fieldType)
        {
            if (UniqueValueRenderer == null)
                return;

            UniqueValueInfo newUniqueValue = new UniqueValueInfoObj()
            {
                SerializedValue = newValue,
                Symbol = UniqueValueRenderer.DefaultSymbol != null ? UniqueValueRenderer.DefaultSymbol.CloneSymbol() : UniqueValueRenderer.GetDefaultSymbolClone(GeometryType),
                FieldType = fieldType,
            };

            UniqueValueConfigControl uniqueValueConfigControl = createNewUniqueValueConfigControl(newUniqueValue);
            UniqueValueRenderer.Infos.Add(newUniqueValue);

            if (UniqueValueConfigItems != null)
            {
                UniqueValueConfigItems.Items.Add(uniqueValueConfigControl);
                UniqueValueConfigItems.SelectedItem = uniqueValueConfigControl;
            }
        }
Esempio n. 2
0
        private void WriteUniqueValueInfo(UniqueValueInfo uniqueValueInfo)
        {
            if (uniqueValueInfo == null)
            {
                return;
            }

            UniqueValueInfoObj uniqueValueInfoObj = uniqueValueInfo as UniqueValueInfoObj;

            if (uniqueValueInfoObj != null)
            {
                writer.WriteStartElement("UniqueValueInfoObj", Namespaces[Constants.esriMappingPrefix]);
                if (uniqueValueInfoObj.Value != null)
                {
                    writer.WriteAttributeString("FieldType", uniqueValueInfoObj.FieldType.ToString());
                    WriteRendererInfoAttributes(uniqueValueInfo);
                    writeUniqueValueObj(uniqueValueInfoObj.SerializedValue);
                }
            }
            else
            {
                writer.WriteStartElement("UniqueValueInfo", Namespaces[Constants.esriPrefix]);
                WriteRendererInfoAttributes(uniqueValueInfo);
                if (uniqueValueInfo.Value != null)
                {
                    writeUniqueValue(uniqueValueInfo.Value);
                }
            }

            if (uniqueValueInfo.Symbol != null)
            {
                writer.WriteStartElement("UniqueValueInfo.Symbol", Namespaces[Constants.esriPrefix]);
                (new SymbolXamlWriter(writer, Namespaces)).WriteSymbol(uniqueValueInfo.Symbol);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }