public void Render(MapPolygon mapPolygon, Shape coreShape, bool hasScope)
        {
            bool flag = PolygonTemplateMapper.UseCustomTemplate(mapPolygon, hasScope);
            MapPolygonTemplate mapPolygonTemplate = (!flag) ? this.MapPolygonLayer.MapPolygonTemplate : mapPolygon.MapPolygonTemplate;
            bool ignoreBackgroundColor            = !flag && this.m_polygonLayerMapper.HasColorRule(coreShape) && hasScope;

            if (mapPolygonTemplate == null)
            {
                base.RenderStyle(null, null, coreShape, ignoreBackgroundColor, hasScope);
                coreShape.BorderStyle = base.GetBorderStyle(null, null, hasScope);
            }
            else
            {
                base.RenderSpatialElementTemplate(mapPolygonTemplate, coreShape, ignoreBackgroundColor, hasScope);
                Style         style  = mapPolygonTemplate.Style;
                StyleInstance style2 = mapPolygonTemplate.Instance.Style;
                coreShape.BorderStyle = base.GetBorderStyle(style, style2, hasScope);
                ReportDoubleProperty scaleFactor = mapPolygonTemplate.ScaleFactor;
                if (scaleFactor != null)
                {
                    if (!scaleFactor.IsExpression)
                    {
                        coreShape.ScaleFactor = scaleFactor.Value;
                    }
                    else if (hasScope)
                    {
                        coreShape.ScaleFactor = mapPolygonTemplate.Instance.ScaleFactor;
                    }
                }
                ReportDoubleProperty centerPointOffsetX = mapPolygonTemplate.CenterPointOffsetX;
                if (centerPointOffsetX != null)
                {
                    if (!centerPointOffsetX.IsExpression)
                    {
                        coreShape.CentralPointOffset.X = centerPointOffsetX.Value;
                    }
                    else if (hasScope)
                    {
                        coreShape.CentralPointOffset.X = mapPolygonTemplate.Instance.CenterPointOffsetX;
                    }
                }
                centerPointOffsetX = mapPolygonTemplate.CenterPointOffsetY;
                if (centerPointOffsetX != null)
                {
                    if (!centerPointOffsetX.IsExpression)
                    {
                        coreShape.CentralPointOffset.Y = centerPointOffsetX.Value;
                    }
                    else if (hasScope)
                    {
                        coreShape.CentralPointOffset.Y = mapPolygonTemplate.Instance.CenterPointOffsetY;
                    }
                }
                ReportEnumProperty <MapAutoBool> showLabel = mapPolygonTemplate.ShowLabel;
                if (showLabel != null)
                {
                    if (!showLabel.IsExpression)
                    {
                        coreShape.TextVisibility = this.GetTextVisibility(showLabel.Value);
                    }
                    else if (hasScope)
                    {
                        coreShape.TextVisibility = this.GetTextVisibility(mapPolygonTemplate.Instance.ShowLabel);
                    }
                }
                ReportEnumProperty <MapPolygonLabelPlacement> labelPlacement = mapPolygonTemplate.LabelPlacement;
                if (labelPlacement != null)
                {
                    if (!labelPlacement.IsExpression)
                    {
                        coreShape.TextAlignment = this.GetTextAlignment(labelPlacement.Value);
                    }
                    else if (hasScope)
                    {
                        coreShape.TextAlignment = this.GetTextAlignment(mapPolygonTemplate.Instance.LabelPlacement);
                    }
                }
            }
        }
Exemple #2
0
        protected void RenderSpatialElementTemplate(MapSpatialElementTemplate mapSpatialElementTemplate, ISpatialElement coreSpatialElement, bool ignoreBackgroundColor, bool hasScope)
        {
            ReportStringProperty toolTip = mapSpatialElementTemplate.ToolTip;
            string text = null;

            if (toolTip != null)
            {
                if (!toolTip.IsExpression)
                {
                    text = toolTip.Value;
                }
                else if (hasScope)
                {
                    text = mapSpatialElementTemplate.Instance.ToolTip;
                }
                if (text != null)
                {
                    text = (coreSpatialElement.ToolTip = VectorLayerMapper.AddPrefixToFieldNames(this.m_mapVectorLayer.Name, text));
                }
            }
            this.m_mapMapper.RenderActionInfo(mapSpatialElementTemplate.ActionInfo, text, coreSpatialElement, this.m_mapVectorLayer.Name, hasScope);
            ReportBoolProperty hidden = mapSpatialElementTemplate.Hidden;

            if (hidden != null)
            {
                if (!hidden.IsExpression)
                {
                    coreSpatialElement.Visible = !hidden.Value;
                }
                else if (hasScope)
                {
                    coreSpatialElement.Visible = !mapSpatialElementTemplate.Instance.Hidden;
                }
                else
                {
                    coreSpatialElement.Visible = true;
                }
            }
            else
            {
                coreSpatialElement.Visible = true;
            }
            ReportStringProperty label = mapSpatialElementTemplate.Label;

            if (label != null)
            {
                string text3 = "";
                if (!label.IsExpression)
                {
                    text3 = label.Value;
                }
                else if (hasScope)
                {
                    text3 = mapSpatialElementTemplate.Instance.Label;
                }
                if (text3 != null)
                {
                    coreSpatialElement.Text = VectorLayerMapper.AddPrefixToFieldNames(this.m_mapVectorLayer.Name, text3);
                }
            }
            ReportDoubleProperty offsetX = mapSpatialElementTemplate.OffsetX;
            double x = 0.0;

            if (offsetX != null)
            {
                if (!offsetX.IsExpression)
                {
                    x = offsetX.Value;
                }
                else if (hasScope)
                {
                    x = mapSpatialElementTemplate.Instance.OffsetX;
                }
                coreSpatialElement.Offset.X = x;
            }
            offsetX = mapSpatialElementTemplate.OffsetY;
            x       = 0.0;
            if (offsetX != null)
            {
                if (!offsetX.IsExpression)
                {
                    x = offsetX.Value;
                }
                else if (hasScope)
                {
                    x = mapSpatialElementTemplate.Instance.OffsetY;
                }
                coreSpatialElement.Offset.Y = x;
            }
            Style         style  = mapSpatialElementTemplate.Style;
            StyleInstance style2 = mapSpatialElementTemplate.Instance.Style;

            this.RenderStyle(style, style2, coreSpatialElement, ignoreBackgroundColor, hasScope);
        }