Exemplo n.º 1
0
        internal void Render(MapPolygon mapPolygon, Shape coreShape, bool hasScope)
        {
            bool num = UseCustomTemplate(mapPolygon, hasScope);
            MapPolygonTemplate mapPolygonTemplate = (!num) ? MapPolygonLayer.MapPolygonTemplate : mapPolygon.MapPolygonTemplate;
            bool ignoreBackgroundColor            = !num && m_polygonLayerMapper.HasColorRule(coreShape) && hasScope;

            if (mapPolygonTemplate == null)
            {
                RenderStyle(null, null, coreShape, ignoreBackgroundColor, hasScope);
                coreShape.BorderStyle = GetBorderStyle(null, null, hasScope);
                return;
            }
            RenderSpatialElementTemplate(mapPolygonTemplate, coreShape, ignoreBackgroundColor, hasScope);
            Style         style  = mapPolygonTemplate.Style;
            StyleInstance style2 = mapPolygonTemplate.Instance.Style;

            coreShape.BorderStyle = 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 = GetTextVisibility(showLabel.Value);
                }
                else if (hasScope)
                {
                    coreShape.TextVisibility = GetTextVisibility(mapPolygonTemplate.Instance.ShowLabel);
                }
            }
            ReportEnumProperty <MapPolygonLabelPlacement> labelPlacement = mapPolygonTemplate.LabelPlacement;

            if (labelPlacement != null)
            {
                if (!labelPlacement.IsExpression)
                {
                    coreShape.TextAlignment = GetTextAlignment(labelPlacement.Value);
                }
                else if (hasScope)
                {
                    coreShape.TextAlignment = GetTextAlignment(mapPolygonTemplate.Instance.LabelPlacement);
                }
            }
        }
        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(m_mapVectorLayer.Name, text));
                }
            }
            m_mapMapper.RenderActionInfo(mapSpatialElementTemplate.ActionInfo, text, coreSpatialElement, 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(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;

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