예제 #1
0
        private void SetItemInternal(object item, double previewScale, int themeCategory)
        {
            m_prt  = item as IPointRule;
            m_lrt  = item as ILineRule;
            m_art  = item as IAreaRule;
            m_comp = item as ICompositeRule;

            try
            {
                m_isUpdating = true;
                if (m_prt != null)
                {
                    RuleCondition.Text = m_prt.Filter;
                    LegendLabel.Text   = m_prt.LegendLabel;
                    Image w2d = null;
                    if (m_prt.PointSymbolization2D != null)
                    {
                        //Determine if this is a w2d symbol style
                        if (m_prt.PointSymbolization2D.Symbol.Type == PointSymbolType.W2D)
                        {
                            var sym = (IW2DSymbol)m_prt.PointSymbolization2D.Symbol;
                            w2d = SymbolPicker.GetSymbol(_conn, sym.W2DSymbol.ResourceId, sym.W2DSymbol.LibraryItemName);
                        }
                    }
                    FeatureStyle.SetItem(m_prt, m_prt.PointSymbolization2D, w2d, previewScale, themeCategory);
                    LabelStyle.SetItem(m_prt, m_prt.Label, previewScale, themeCategory);
                    LabelStyle.Visible = true;
                }
                else if (m_lrt != null)
                {
                    RuleCondition.Text = m_lrt.Filter;
                    LegendLabel.Text   = m_lrt.LegendLabel;
                    FeatureStyle.SetItem(m_lrt, m_lrt.Strokes, previewScale, themeCategory);
                    LabelStyle.SetItem(m_lrt, m_lrt.Label, previewScale, themeCategory);
                    LabelStyle.Visible = true;
                }
                else if (m_art != null)
                {
                    RuleCondition.Text = m_art.Filter;
                    LegendLabel.Text   = m_art.LegendLabel;
                    FeatureStyle.SetItem(m_art, m_art.AreaSymbolization2D, previewScale, themeCategory);
                    LabelStyle.SetItem(m_art, m_art.Label, previewScale, themeCategory);
                    LabelStyle.Visible = true;
                }
                else if (m_comp != null)
                {
                    RuleCondition.Text = m_comp.Filter;
                    LegendLabel.Text   = m_comp.LegendLabel;
                    FeatureStyle.SetItem(m_comp, m_comp.CompositeSymbolization, previewScale, themeCategory);
                    LabelStyle.Visible = false;
                }
            }
            finally
            {
                m_isUpdating = false;
            }
        }
예제 #2
0
        private void buttonChangeSymbol_Click(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaCommunicatorDataSet1, TEXT_TABLE].Current as DataRowView;

            ADACommunicatorDataSet.TextRow textRow = view.Row as ADACommunicatorDataSet.TextRow;

            SymbolPicker picker = new SymbolPicker();

            SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this,
                                                                           textRow.IsSymbolIdNull() ? -1 : textRow.SymbolId);

            if (symbolRow != null)
            {
                if (adaCommunicatorDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null)
                {
                    ADACommunicatorDataSet.SymbolRow newRow = adaCommunicatorDataSet1.Symbol.NewSymbolRow();
                    newRow.SymbolId = symbolRow.SymbolId;

                    if (!symbolRow.IsSoundNull())
                    {
                        newRow.Sound = symbolRow.Sound;
                    }

                    if (!symbolRow.IsImageNull())
                    {
                        newRow.Image = symbolRow.Image;
                    }

                    adaCommunicatorDataSet1.Symbol.AddSymbolRow(newRow);
                    adaCommunicatorDataSet1.Symbol.AcceptChanges();
                }

                byte[] image = symbolRow.Image;
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                buttonPlaySound.Enabled = !symbolRow.IsSoundNull();

                this.BindingContext[adaCommunicatorDataSet1, TEXT_TABLE].EndCurrentEdit();

                view.BeginEdit();
                if (textRow.IsNameNull() || textRow.Name.Length == 0)
                {
                    textRow.Name = symbolRow.Name;
                }
                if (textRow.IsDescriptonNull() || textRow.Descripton.Length == 0)
                {
                    textRow.Descripton = textRow.Name;
                }
                textRow.SymbolId = symbolRow.SymbolId;
                view.EndEdit();
            }
        }
예제 #3
0
        private void buttonChangeSymbol_Click(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow;

            SymbolPicker picker = new SymbolPicker();

            SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this,
                                                                           activityRow.IsSymbolIdNull() ? -1 : activityRow.SymbolId);

            if (symbolRow != null)
            {
                if (adaScheduleDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null)
                {
                    ADAScheduleDataSet.SymbolRow newRow = adaScheduleDataSet1.Symbol.NewSymbolRow();
                    newRow.SymbolId = symbolRow.SymbolId;

                    if (!symbolRow.IsSoundNull())
                    {
                        newRow.Sound = symbolRow.Sound;
                    }

                    if (!symbolRow.IsImageNull())
                    {
                        newRow.Image = symbolRow.Image;
                    }

                    adaScheduleDataSet1.Symbol.AddSymbolRow(newRow);
                }

                byte[] image = symbolRow.Image;
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                buttonPlaySound.Enabled = !symbolRow.IsSoundNull();

                this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].EndCurrentEdit();

                view.BeginEdit();
                activityRow.Name     = symbolRow.Name;
                activityRow.SymbolId = symbolRow.SymbolId;
                activityRow.Image    = image;
                view.EndEdit();
            }
        }
예제 #4
0
        private void btnBrowseSymbolName_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.SymbolLibraryID))
            {
                MessageBox.Show(Strings.SelectSymbolLibraryFirst);
                return;
            }

            using (var picker = new SymbolPicker(this.SymbolLibraryID, _conn))
            {
                if (picker.ShowDialog() == DialogResult.OK)
                {
                    this.SymbolName = picker.SymbolName;
                }
            }
        }
        public override void Run()
        {
            var wb   = Workbench.Instance;
            var exp  = wb.ActiveSiteExplorer;
            var mgr  = ServiceRegistry.GetService <ServerConnectionManager>();
            var conn = mgr.GetConnection(exp.ConnectionName);

            var picker = new ResourcePicker(conn, ResourceTypes.SymbolLibrary.ToString(), ResourcePickerMode.OpenResource);

            if (picker.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK)
            {
                var browser = new SymbolPicker(picker.ResourceID, conn);
                if (browser.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK)
                {
                    MessageService.ShowMessage(browser.SymbolName);
                    return;
                }
            }
            MessageService.ShowMessage(Strings.Cancelled);
        }