コード例 #1
0
        private void symbolSelectorControl1_SymbolSelected(object sender, SymbolSelector.SymbolSelectedEventArgs e)
        {
            Font oFont = new Font(e.CurrentFont.Name, 50, FontStyle.Bold, GraphicsUnit.Pixel);
            this.label1.Font = oFont;

            this.label1.Text = new String((char)e.SymbolIndex,1);
            this.label1.ForeColor = Color.Blue;
        }
コード例 #2
0
        public static SymbolSelector TryParse(String value)
        {
            Match match = parseRegx.Match(value);

            if (match.Success)
            {
                SymbolSelector selector = new SymbolSelector();
                selector.Symbol = match.Groups[1].Value;
                if (match.Groups[4].Success) //If selector is a single bit
                {
                    selector.Selector = new BitMask(int.Parse(match.Groups[4].Value));
                }
                else
                {
                    selector.Selector = new BitMask(int.Parse(match.Groups[2].Value), int.Parse(match.Groups[3].Value));
                }
                return(selector);
            }
            return(null);
        }
コード例 #3
0
        public Object SubArgumentsAndSymbols(Object original, Sequence macro, SequenceMacroReference macroReference, String expansionSymbol) //Substitute paramater references with arguments, prepend expansion symbol to internal symbol references
        {
            if (!(original is String))
            {
                return(original);                       //No operation required if original is a literal value
            }
            String         value = original as String;
            SymbolSelector sel   = SymbolSelector.TryParse(value);

            if (sel != null)
            {
                value = sel.Symbol;
                Object newValue = (macro.Parameters.Contains(value)) ? macroReference.Arguments[macro.Parameters.IndexOf(value)]
                   : (macro.Symbols.ContainsKey(value)) ? expansionSymbol + "." + value
                   : value;
                return(newValue.ToString() + $"[{sel.Selector.ToString()}]");
            }
            else
            {
                return((macro.Parameters.Contains(value)) ? macroReference.Arguments[macro.Parameters.IndexOf(value)]
                   : (macro.Symbols.ContainsKey(value)) ? expansionSymbol + "." + value
                   : value);
            }
        }
コード例 #4
0
        /// <summary>
        /// 双击TOC修改符号系统
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void axTOCControl1_OnDoubleClick(object sender, ESRI.ArcGIS.Controls.ITOCControlEvents_OnDoubleClickEvent e)
        {
            esriTOCControlItem pTocControlItem = esriTOCControlItem.esriTOCControlItemNone;
            ILayer             pLayer          = null;
            IBasicMap          pBasicMap       = null;
            object             unk             = null;
            object             data            = null;

            if (e.button == 1)
            {
                axTOCControl1.HitTest(e.x, e.y, ref pTocControlItem, ref pBasicMap, ref pLayer, ref unk, ref data);
                System.Drawing.Point pos = new System.Drawing.Point(e.x, e.y);
                if (pTocControlItem == esriTOCControlItem.esriTOCControlItemLegendClass)
                {
                    ILegendClass pLegendClass = new LegendClass();
                    ILegendGroup pLegendGroup = new LegendGroup();
                    if (unk is ILegendGroup)
                    {
                        pLegendGroup = unk as ILegendGroup;
                    }
                    pLegendClass = pLegendGroup.get_Class((int)data);
                    ISymbol pSymbol;
                    pSymbol = pLegendClass.Symbol;
                    ISymbolSelector pSymbolSelector = new SymbolSelector();
                    bool            isOk            = false;
                    pSymbolSelector.AddSymbol(pSymbol);
                    isOk = pSymbolSelector.SelectSymbol(0);
                    if (isOk)
                    {
                        pLegendClass.Symbol = pSymbolSelector.GetSymbolAt(0);
                    }
                    this.axMapControl1.ActiveView.Refresh();
                    this.axTOCControl1.Refresh();
                }
            }
        }
コード例 #5
0
        public void ResolveSymbols(Microprogram microprogram, List <Sequence> placedSequences) //Resolve all symbol references to numeric values
        {
            foreach (Sequence sequence in placedSequences)
            {
                foreach (SequenceStep step in sequence.Steps)
                {
                    if (step is SequenceMacroReference)
                    {
                        throw new MicroassemblerLinkException($"Encountered unexpanded macro on line {step.Line}");
                    }
                    if (step is SequenceAssertion)
                    {
                        SequenceAssertion assertion = step as SequenceAssertion;
                        foreach (ControlWordLabel key in assertion.AssertedSignals.Keys.ToList())
                        {
                            Object value = assertion.AssertedSignals[key];
                            if (!(value is long))
                            {
                                String         symbol = value.ToString();
                                SymbolSelector sel    = SymbolSelector.TryParse(symbol);
                                if (sel != null)
                                {
                                    if (long.TryParse(sel.Symbol, out long intValue))
                                    {
                                        assertion.AssertedSignals[key] = (intValue & sel.Selector.ToLongMask()) >> sel.Selector.LowerBound;
                                    }
                                    else
                                    {
                                        symbol = sel.Symbol;
                                        Object resolvedSymbol = (sequence[symbol] != null) ? sequence[symbol] : microprogram[symbol];
                                        if (resolvedSymbol == null)
                                        {
                                            throw new MicroassemblerLinkException($"Symbol {symbol} referenced by assertion on line {assertion.Line} is not defined");
                                        }
                                        if (resolvedSymbol is ISymbolResolver)
                                        {
                                            resolvedSymbol = (resolvedSymbol as ISymbolResolver).Resolve();
                                        }
                                        if (!(resolvedSymbol is long))
                                        {
                                            throw new MicroassemblerLinkException($"Symbol {symbol} resolved to {resolvedSymbol}, all symbols should resolve to a number");
                                        }
                                        assertion.AssertedSignals[key] = ((long)resolvedSymbol & sel.Selector.ToLongMask()) >> sel.Selector.LowerBound;
                                    }
                                }
                                else
                                {
                                    Object resolvedSymbol = (sequence[symbol] != null) ? sequence[symbol] : microprogram[symbol];
                                    if (resolvedSymbol == null)
                                    {
                                        throw new MicroassemblerLinkException($"Symbol {symbol} referenced by assertion on line {assertion.Line} is not defined");
                                    }
                                    if (resolvedSymbol is ISymbolResolver)
                                    {
                                        resolvedSymbol = (resolvedSymbol as ISymbolResolver).Resolve();
                                    }
                                    if (!(resolvedSymbol is long))
                                    {
                                        throw new MicroassemblerLinkException($"Symbol {symbol} resolved to {resolvedSymbol}, all symbols should resolve to a number");
                                    }
                                    assertion.AssertedSignals[key] = resolvedSymbol;
                                }
                            }
                        }
                    }
                }
            }
            //Resolve empty step
            SequenceAssertion emptyAssertion = microprogram.EmptyAssertion;

            if (microprogram.EmptyAssertion == null)
            {
                throw new MicroassemblerLinkException("The empty/default sequence step is not defined");
            }
            foreach (ControlWordLabel key in emptyAssertion.AssertedSignals.Keys.ToList())
            {
                Object value = emptyAssertion.AssertedSignals[key];
                if (!(value is long))
                {
                    String symbol         = value.ToString();
                    Object resolvedSymbol = microprogram[symbol];
                    if (resolvedSymbol == null)
                    {
                        throw new MicroassemblerLinkException($"Symbol {symbol} referenced by assertion on line {emptyAssertion.Line} is not defined");
                    }
                    if (resolvedSymbol is ISymbolResolver)
                    {
                        resolvedSymbol = (resolvedSymbol as ISymbolResolver).Resolve();
                    }
                    emptyAssertion.AssertedSignals[key] = resolvedSymbol;
                }
            }
        }
コード例 #6
0
 /// <summary>
 /// 向AxSymbologyControl加载指定图例,初始化符号选择器
 /// </summary>
 /// <param name="layer">要设置样式的图层</param>
 /// <param name="legendClass">当前所选的图层图例(包含符号(Symbol)及其标注与描述等)</param>
 public void LoadSymbolSelector(ILayer layer, ILegendClass legendClass)
 {
     Selector = new SymbolSelector(this.axSymbologyControl1, layer, legendClass);
 }