private void SetSymbolRuleMarkers(PredefinedSymbolCollection customSymbols)
        {
            int                 bucketCount   = base.GetBucketCount();
            MapMarkerRule       mapMarkerRule = (MapMarkerRule)base.m_mapRule;
            MapMarkerCollection mapMarkers    = mapMarkerRule.MapMarkers;
            int                 count         = mapMarkers.Count;
            MapBucketCollection mapBuckets    = base.m_mapRule.MapBuckets;
            bool                flag          = base.GetDistributionType() == MapRuleDistributionType.Custom;

            for (int i = 0; i < bucketCount; i++)
            {
                PredefinedSymbol predefinedSymbol = new PredefinedSymbol();
                if (i < count)
                {
                    this.RenderMarker(predefinedSymbol, ((ReportElementCollectionBase <MapMarker>)mapMarkers)[i]);
                }
                else
                {
                    predefinedSymbol.MarkerStyle = MarkerStyle.None;
                }
                if (flag)
                {
                    MapBucket bucket = ((ReportElementCollectionBase <MapBucket>)mapBuckets)[i];
                    predefinedSymbol.FromValue = base.GetFromValue(bucket);
                    predefinedSymbol.ToValue   = base.GetToValue(bucket);
                }
                customSymbols.Add(predefinedSymbol);
            }
        }
Example #2
0
        private void SetSymbolRuleSizes(PredefinedSymbolCollection customSymbols)
        {
            int bucketCount = GetBucketCount();

            if (bucketCount == 0)
            {
                return;
            }
            double startSize = GetStartSize();
            double num       = (GetEndSize() - startSize) / (double)bucketCount;
            MapBucketCollection mapBuckets = m_mapRule.MapBuckets;
            bool flag = GetDistributionType() == MapRuleDistributionType.Custom;

            for (int i = 0; i < bucketCount; i++)
            {
                PredefinedSymbol predefinedSymbol = new PredefinedSymbol();
                float            num4             = predefinedSymbol.Width = (predefinedSymbol.Height = (int)Math.Round(startSize + (double)i * num));
                if (flag)
                {
                    MapBucket bucket = mapBuckets[i];
                    predefinedSymbol.FromValue = GetFromValue(bucket);
                    predefinedSymbol.ToValue   = GetToValue(bucket);
                }
                customSymbols.Add(predefinedSymbol);
            }
        }
Example #3
0
        private void SetSymbolRuleSizes(PredefinedSymbolCollection customSymbols)
        {
            int bucketCount = base.GetBucketCount();

            if (bucketCount != 0)
            {
                double startSize = this.GetStartSize();
                double num       = (this.GetEndSize() - startSize) / (double)bucketCount;
                MapBucketCollection mapBuckets = base.m_mapRule.MapBuckets;
                bool flag = base.GetDistributionType() == MapRuleDistributionType.Custom;
                for (int i = 0; i < bucketCount; i++)
                {
                    PredefinedSymbol predefinedSymbol  = new PredefinedSymbol();
                    PredefinedSymbol predefinedSymbol2 = predefinedSymbol;
                    PredefinedSymbol predefinedSymbol3 = predefinedSymbol;
                    float            num4 = predefinedSymbol2.Width = (predefinedSymbol3.Height = (float)(int)Math.Round(startSize + (double)i * num));
                    if (flag)
                    {
                        MapBucket bucket = ((ReportElementCollectionBase <MapBucket>)mapBuckets)[i];
                        predefinedSymbol.FromValue = base.GetFromValue(bucket);
                        predefinedSymbol.ToValue   = base.GetToValue(bucket);
                    }
                    customSymbols.Add(predefinedSymbol);
                }
            }
        }
Example #4
0
        private void SetSymbolRuleColors(Color[] colorRange, PredefinedSymbolCollection customSymbols)
        {
            MapBucketCollection mapBuckets = m_mapRule.MapBuckets;
            bool flag        = GetDistributionType() == MapRuleDistributionType.Custom;
            int  bucketCount = GetBucketCount();

            for (int i = 0; i < bucketCount; i++)
            {
                PredefinedSymbol predefinedSymbol = new PredefinedSymbol();
                if (i < colorRange.Length)
                {
                    predefinedSymbol.Color = colorRange[i];
                }
                else
                {
                    predefinedSymbol.Color = Color.Empty;
                }
                if (flag)
                {
                    MapBucket bucket = mapBuckets[i];
                    predefinedSymbol.FromValue = GetFromValue(bucket);
                    predefinedSymbol.ToValue   = GetToValue(bucket);
                }
                customSymbols.Add(predefinedSymbol);
            }
        }
        private void SetSymbolRuleMarkers(PredefinedSymbolCollection customSymbols)
        {
            int bucketCount = GetBucketCount();
            MapMarkerCollection mapMarkers = ((MapMarkerRule)m_mapRule).MapMarkers;
            int count = mapMarkers.Count;
            MapBucketCollection mapBuckets = m_mapRule.MapBuckets;
            bool flag = GetDistributionType() == MapRuleDistributionType.Custom;

            for (int i = 0; i < bucketCount; i++)
            {
                PredefinedSymbol predefinedSymbol = new PredefinedSymbol();
                if (i < count)
                {
                    RenderMarker(predefinedSymbol, mapMarkers[i]);
                }
                else
                {
                    predefinedSymbol.MarkerStyle = MarkerStyle.None;
                }
                if (flag)
                {
                    MapBucket bucket = mapBuckets[i];
                    predefinedSymbol.FromValue = GetFromValue(bucket);
                    predefinedSymbol.ToValue   = GetToValue(bucket);
                }
                customSymbols.Add(predefinedSymbol);
            }
        }
Example #6
0
        private void ProcessKeyword(KeywordToken keywordToken)
        {
            PredefinedSymbol keyword = keywordToken.SymbolType;

            if (keyword == PredefinedSymbol.If)
            {
                _source.ExpectKeyword(PredefinedSymbol.OpenParenthesis);

                Expression condition = ReadExpression(true, PredefinedSymbol.CloseParenthesis);

                GenerateCodeForExpression(condition);

                ProcessCodeBlock();

                if (_source.NextIsKeyword(PredefinedSymbol.Else))
                {
                    ProcessCodeBlock();
                }
            }
            else if (keyword == PredefinedSymbol.While)
            {
                _source.ExpectKeyword(PredefinedSymbol.OpenParenthesis);

                Expression condition = ReadExpression(true, PredefinedSymbol.CloseParenthesis);

                GenerateCodeForExpression(condition);

                ProcessCodeBlock();
            }
            else if (keyword == PredefinedSymbol.For)
            {
                // TODO: Handle for loops
            }
            else if (keyword == PredefinedSymbol.Break)
            {
                // TODO: Handle break
            }
            else if (keyword == PredefinedSymbol.Continue)
            {
                // TODO: Handle continue
            }
            else if (keyword == PredefinedSymbol.Return)
            {
                Expression resultToReturn = ReadExpression(true, PredefinedSymbol.Semicolon);

                GenerateCodeForExpression(resultToReturn);

                // TODO: Generate code to return and release local vars
                FreeAllLocalVariablesButLeaveValid();
            }
            else
            {
                throw new CompilerMessage(ErrorCode.InvalidUseOfKeyword, "Keyword '" + keywordToken.Name + "' is not valid here");
            }
        }
Example #7
0
 public bool IsModifierPresent(PredefinedSymbol symbol)
 {
     foreach (ModifierToken token in _nextTokenModifiers)
     {
         if (token.Symbol == symbol)
         {
             return(true);
         }
     }
     return(false);
 }
Example #8
0
 public bool IsModifierPresent(PredefinedSymbol symbol)
 {
     foreach (ModifierToken token in _nextTokenModifiers)
     {
         if (token.Symbol == symbol)
         {
             return true;
         }
     }
     return false;
 }
Example #9
0
 protected void InitializePredefinedSymbols(PredefinedSymbol predefinedSymbol, PointTemplateMapper symbolTemplateMapper)
 {
     predefinedSymbol.BorderColor    = symbolTemplateMapper.GetBorderColor(hasScope: false);
     predefinedSymbol.BorderStyle    = symbolTemplateMapper.GetBorderStyle(hasScope: false);
     predefinedSymbol.BorderWidth    = symbolTemplateMapper.GetBorderWidth(hasScope: false);
     predefinedSymbol.Font           = symbolTemplateMapper.GetFont(hasScope: false);
     predefinedSymbol.GradientType   = symbolTemplateMapper.GetGradientType(hasScope: false);
     predefinedSymbol.HatchStyle     = symbolTemplateMapper.GetHatchStyle(hasScope: false);
     predefinedSymbol.SecondaryColor = symbolTemplateMapper.GetBackGradientEndColor(hasScope: false);
     predefinedSymbol.ShadowOffset   = symbolTemplateMapper.GetShadowOffset(hasScope: false);
     predefinedSymbol.TextColor      = symbolTemplateMapper.GetTextColor(hasScope: false);
     predefinedSymbol.LegendText     = "";
     predefinedSymbol.Text           = "";
 }
Example #10
0
        private void ProcessTokenAtTopLevel(Token thisToken)
        {
            if (thisToken is ModifierToken)
            {
                _state.NextTokenModifiers.Add((ModifierToken)thisToken);
            }
            else if (thisToken.IsVariableType)
            {
                bool wasFunction = false;
                do
                {
                    wasFunction = ParseAndAddGlobalVariableOrFunction(thisToken);
                }while ((!wasFunction) && (_source.NextIsKeyword(PredefinedSymbol.Comma)));

                if (!wasFunction)
                {
                    _source.ExpectKeyword(PredefinedSymbol.Semicolon);
                }
                _state.NextTokenModifiers.Clear();
            }
            else if (thisToken is KeywordToken)
            {
                PredefinedSymbol keyword = ((KeywordToken)thisToken).SymbolType;
                if (keyword == PredefinedSymbol.StructDefinition)
                {
                    _output.AddStruct(ProcessStructDeclaration());
                }
                else if (keyword == PredefinedSymbol.Enum)
                {
                    ProcessEnumDeclaration();
                }
                else if (keyword == PredefinedSymbol.Export)
                {
                    ProcessExportCommand();
                }
                else
                {
                    RecordError(ErrorCode.InvalidUseOfKeyword, "Invalid use of '" + thisToken.Name + "'");
                }
            }
            else if (thisToken.Name.StartsWith(Constants.NEW_SCRIPT_MARKER))
            {
                _scriptName = thisToken.Name.Substring(Constants.NEW_SCRIPT_MARKER.Length, thisToken.Name.Length - Constants.NEW_SCRIPT_MARKER.Length - 1);
            }
            else
            {
                RecordError(ErrorCode.UnexpectedToken, "Unexpected '" + thisToken.Name + "'");
            }
        }
 private void InitializePredefinedSymbols(PredefinedSymbolCollection predefinedSymbols, PointTemplateMapper spatialElementTemplateMapper, Color?color, int?size)
 {
     foreach (PredefinedSymbol predefinedSymbol4 in predefinedSymbols)
     {
         if (color.HasValue)
         {
             predefinedSymbol4.Color = color.Value;
         }
         if (size.HasValue)
         {
             PredefinedSymbol predefinedSymbol2 = predefinedSymbol4;
             PredefinedSymbol predefinedSymbol3 = predefinedSymbol4;
             float            num3 = predefinedSymbol2.Width = (predefinedSymbol3.Height = (float)size.Value);
         }
         base.InitializePredefinedSymbols(predefinedSymbol4, spatialElementTemplateMapper);
     }
 }
Example #12
0
 private void InitializePredefinedSymbols(PredefinedSymbolCollection predefinedSymbols, PointTemplateMapper symbolTemplateMapper, int?size, MarkerStyle?markerStyle)
 {
     foreach (PredefinedSymbol predefinedSymbol4 in predefinedSymbols)
     {
         if (size.HasValue)
         {
             PredefinedSymbol predefinedSymbol2 = predefinedSymbol4;
             PredefinedSymbol predefinedSymbol3 = predefinedSymbol4;
             float            num3 = predefinedSymbol2.Width = (predefinedSymbol3.Height = (float)size.Value);
         }
         if (markerStyle.HasValue)
         {
             predefinedSymbol4.MarkerStyle = markerStyle.Value;
         }
         base.InitializePredefinedSymbols(predefinedSymbol4, symbolTemplateMapper);
     }
 }
Example #13
0
        /// <summary>Gets the <see cref="T:ComparisonOperator"/> that matches the specified <see cref="T:PredefinedSymbol"/>.</summary>
        /// <param name="symbol">The <see cref="T:PredefinedSymbol"/> to match.</param>
        /// <returns>The matched <see cref="T:ComparisonOperator"/>.</returns>
        public static ComparisonOperator GetOperator(PredefinedSymbol symbol)
        {
            switch (symbol)
            {
            case PredefinedSymbol.Equal: return(ComparisonOperator.Equal);

            case PredefinedSymbol.NotEqual: return(ComparisonOperator.NotEqual);

            case PredefinedSymbol.LessThan: return(ComparisonOperator.LessThan);

            case PredefinedSymbol.GreaterThan: return(ComparisonOperator.GreaterThan);

            case PredefinedSymbol.LessThanOrEqual: return(ComparisonOperator.LessThanOrEqual);

            case PredefinedSymbol.GreaterThanOrEqual: return(ComparisonOperator.GreaterThanOrEqual);

            default: return(ComparisonOperator.None);
            }
        }
        private void RenderMarker(PredefinedSymbol customSymbol, MapMarker mapMarker)
        {
            MapMarkerStyle markerStyle = MapMapper.GetMarkerStyle(mapMarker, hasScope: true);

            if (markerStyle != MapMarkerStyle.Image)
            {
                customSymbol.MarkerStyle = MapMapper.GetMarkerStyle(markerStyle);
                return;
            }
            MapMarkerImage mapMarkerImage = mapMarker.MapMarkerImage;

            if (mapMarkerImage == null)
            {
                throw new RenderingObjectModelException(RPRes.rsMapLayerMissingProperty(RPRes.rsObjectTypeMap, m_mapRule.MapDef.Name, m_mapVectorLayer.Name, "MapMarkerImage"));
            }
            customSymbol.Image           = m_mapMapper.AddImage(mapMarkerImage);
            customSymbol.ImageResizeMode = m_mapMapper.GetImageResizeMode(mapMarkerImage);
            customSymbol.ImageTransColor = m_mapMapper.GetImageTransColor(mapMarkerImage);
        }
Example #15
0
        private bool NextIsKeyword(PredefinedSymbol[] symbolTypes, bool throwIfNot, bool peekOnly, string customErrorMessage)
        {
            int lineNumberOfNext, readIndexOfNext;

            Token nextToken = PeekNextToken(out lineNumberOfNext, out readIndexOfNext);
            if (nextToken is KeywordToken)
            {
                foreach (PredefinedSymbol symbolType in symbolTypes)
                {
                    if (((KeywordToken)nextToken).SymbolType == symbolType)
                    {
                        if (!peekOnly)
                        {
                            _currentLineNumber = lineNumberOfNext;
                            _readIndex = readIndexOfNext;
                        }
                        return true;
                    }
                }
            }

            if (throwIfNot)
            {
                string errorMessage;
                if (customErrorMessage != null)
                {
                    errorMessage = customErrorMessage;
                }
                else
                {
                    errorMessage = "Unexpected '" + nextToken.Name + "'; was expecting one of ";
                    foreach (PredefinedSymbol symbolType in symbolTypes)
                    {
                        errorMessage += "'" + symbolType.ToString() + "'; ";
                    }
                }
                throw new CompilerMessage(ErrorCode.UnexpectedToken, errorMessage);
            }
            return false;
        }
Example #16
0
 public static bool AdjustBracketLevelIfTokenIsBracket(Token token, ref int bracketLevel)
 {
     if (token is KeywordToken)
     {
         PredefinedSymbol symbol = ((KeywordToken)token).SymbolType;
         if ((symbol == PredefinedSymbol.OpenBrace) ||
             (symbol == PredefinedSymbol.OpenParenthesis) ||
             (symbol == PredefinedSymbol.OpenSquareBracket))
         {
             bracketLevel++;
             return(true);
         }
         else if ((symbol == PredefinedSymbol.CloseBrace) ||
                  (symbol == PredefinedSymbol.CloseParenthesis) ||
                  (symbol == PredefinedSymbol.CloseSquareBracket))
         {
             bracketLevel--;
             return(true);
         }
     }
     return(false);
 }
Example #17
0
 public KeywordToken(string name, PredefinedSymbol symbolType)
     : this(name, symbolType, false)
 {
 }
Example #18
0
 /// <summary>
 /// Determines if the next token is the specified keyword token. Behaviour
 /// depends on parameters.
 /// </summary>
 /// <param name="peekOnly">do not advance the stream if the symbol is found</param>
 /// <returns></returns>
 public bool NextIsKeyword(PredefinedSymbol symbolType, bool peekOnly)
 {
     return(NextIsKeyword(new PredefinedSymbol[1] {
         symbolType
     }, false, peekOnly, null));
 }
Example #19
0
 internal ModifierToken(string name, PredefinedSymbol type, ModifierTargets targets)
     : base(name, true)
 {
     _targets = targets;
     _type    = type;
 }
Example #20
0
 /// <summary>
 /// Reads the next token, and expects it to be the passed in type.
 /// If it isn't, throws an exception with the specified message.
 /// </summary>
 public void ExpectKeyword(PredefinedSymbol symbolTypes, string errorMessage)
 {
     NextIsKeyword(new PredefinedSymbol[] { symbolTypes }, true, false, errorMessage);
 }
Example #21
0
 /// <summary>
 /// Determines if the next token is the specified keyword token. If it
 /// is, reads it from the stream. If not, leaves the stream as-is.
 /// </summary>
 public bool NextIsKeyword(PredefinedSymbol symbolType)
 {
     return(NextIsKeyword(symbolType, false));
 }
Example #22
0
 public KeywordToken(string name, PredefinedSymbol symbolType)
     : this(name, symbolType, false)
 {
 }
Example #23
0
        Token ReadPredefinedSymbolOrSingleLineComment()
        {
            PredefinedSymbol symbol = PredefinedSymbol.None;

            switch (currentChar)
            {
            case '+': symbol = PredefinedSymbol.Plus; break;

            case '*': symbol = PredefinedSymbol.Asterisk; break;

            case '/': symbol = PredefinedSymbol.Slash; break;

            case '^': symbol = PredefinedSymbol.Caret; break;

            case '&': symbol = PredefinedSymbol.Ampersand; break;

            case '(': symbol = PredefinedSymbol.OpenParenthesis; break;

            case ')': symbol = PredefinedSymbol.ClosedParenthesis; break;

            case ',': symbol = PredefinedSymbol.Comma; break;

            case ':':
                if (reader.Peek() == '=')
                {
                    ReadChar(); symbol = PredefinedSymbol.Assignment;
                }
                else
                {
                    symbol = PredefinedSymbol.Colon;
                }
                break;

            case '=': ReadChar(); CheckForExpectedChar('='); symbol = PredefinedSymbol.Equal; break;

            case '<':
                switch (reader.Peek())
                {
                case '>': ReadChar(); symbol = PredefinedSymbol.NotEqual; break;

                case '=': ReadChar(); symbol = PredefinedSymbol.LessThanOrEqual; break;

                default: symbol = PredefinedSymbol.LessThan; break;
                }
                break;

            case '>':
                if (reader.Peek() == '=')
                {
                    ReadChar(); symbol = PredefinedSymbol.GreaterThanOrEqual;
                }
                else
                {
                    symbol = PredefinedSymbol.GreaterThan;
                }
                break;

            case '-':
                if (reader.Peek() == '-')
                {
                    return(ReadSingleLineComment());
                }
                else
                {
                    symbol = PredefinedSymbol.Minus;
                }
                break;
            }

            if (symbol != PredefinedSymbol.None)
            {
                ReadChar();
                return(new PredefinedSymbolToken(symbol, startPosition, previousPosition));
            }
            else
            {
                ThrowException("Invalid character.", currentPosition);
            }
            return(null);
        }
Example #24
0
 internal ModifierToken(string name, PredefinedSymbol type, ModifierTargets targets)
     : base(name, true)
 {
     _targets = targets;
     _type = type;
 }
Example #25
0
 public KeywordToken(string name, PredefinedSymbol symbolType, bool isModificationOperator)
     : base(name, true)
 {
     _symbolType             = symbolType;
     _isModificationOperator = isModificationOperator;
 }
Example #26
0
 /// <summary>Initializes a new instance of the <see cref="PredefinedSymbolToken"/> class.</summary>
 /// <param name="symbol">The symbol.</param>
 /// <param name="startPosition">The start position.</param>
 /// <param name="endPosition">The end position.</param>
 internal PredefinedSymbolToken(PredefinedSymbol symbol, TextPosition startPosition, TextPosition endPosition)
     : base(TokenType.Symbol, startPosition, endPosition)
 {
     this.symbol = symbol;
 }
Example #27
0
 /// <summary>Checks whether this token is the specified predefined symbol token.</summary>
 /// <param name="symbol">The predefined symbol to check.</param>
 /// <returns>If this token equals the specified symbol, true; otherwise, false.</returns>
 public override bool Equals(PredefinedSymbol symbol)
 {
     return(this.symbol == symbol);
 }
Example #28
0
 /// <summary>
 /// Determines if the next token is the specified keyword token. Behaviour
 /// depends on parameters.
 /// </summary>
 /// <param name="peekOnly">do not advance the stream if the symbol is found</param>
 /// <returns></returns>
 public bool NextIsKeyword(PredefinedSymbol symbolType, bool peekOnly)
 {
     return NextIsKeyword(new PredefinedSymbol[1] { symbolType }, false, peekOnly, null);
 }
Example #29
0
 /// <summary>
 /// Determines if the next token is the specified keyword token. If it
 /// is, reads it from the stream. If not, leaves the stream as-is.
 /// </summary>
 public bool NextIsKeyword(PredefinedSymbol symbolType)
 {
     return NextIsKeyword(symbolType, false);
 }
Example #30
0
 /// <summary>
 /// Reads the next token, and expects it to be the passed in type.
 /// If it isn't, throws an exception with the specified message.
 /// </summary>
 public void ExpectKeyword(PredefinedSymbol symbolTypes, string errorMessage)
 {
     NextIsKeyword(new PredefinedSymbol[] { symbolTypes }, true, false, errorMessage);
 }
Example #31
0
 /// <summary>Checks whether this token is the specified predefined symbol token.</summary>
 /// <param name="symbol">The predefined symbol to check.</param>
 /// <returns>If this token equals the specified symbol, true; otherwise, false.</returns>
 public virtual bool Equals(PredefinedSymbol symbol)
 {
     return(false);
 }
Example #32
0
 public KeywordToken(string name, PredefinedSymbol symbolType, bool isModificationOperator)
     : base(name, true)
 {
     _symbolType = symbolType;
     _isModificationOperator = isModificationOperator;
 }