public HttpResponseMessage GetBaseMapTile(int z, int x, int y)
        {
            // Create the LayerOverlay for displaying the map.
            LayerOverlay layerOverlay = OverlayBuilder.GetOverlayAsBaseMap();

            return(DrawTileImage(layerOverlay, x, y, z));
        }
        private static LayerOverlay GetLabelingOverlay(string overlayId, string accessId)
        {
            LayerOverlay selectedOverlay = null;

            switch (overlayId)
            {
            case "LabelStyling":
                selectedOverlay = OverlayBuilder.GetOverlayWithLabelingStyle("LabelStyling", accessId);
                break;

            case "LabelingPoints":
                selectedOverlay = OverlayBuilder.GetOverlayWithLabelingPoint("LabelingPoints", accessId);
                break;

            case "LabelingLines":
                selectedOverlay = OverlayBuilder.GetOverlayWithLabelingLine("LabelingLines", accessId);
                break;

            case "LabelingPolygons":
                selectedOverlay = OverlayBuilder.GetOverlayWithLabelingPolygon("LabelingPolygons", accessId);
                break;

            case "CustomLabeling":
                selectedOverlay = OverlayBuilder.GetOverlayWithCustomLabeling("CustomLabeling", accessId);
                break;

            default:
                break;
            }

            return(selectedOverlay);
        }
Esempio n. 3
0
        private static LayerOverlay GetFilterStyleOverlay(string accessId)
        {
            LayerOverlay layerOverlay = OverlayBuilder.GetOverlayWithFilterStyle();

            Dictionary <string, string> savedFilterStyles = GetSavedStyle(accessId);

            if (savedFilterStyles == null)
            {
                return(layerOverlay);
            }

            string filterExpression = savedFilterStyles["filterExpression"];
            string filterValue      = savedFilterStyles["filterValue"];

            if (filterExpressions.ContainsKey(filterExpression) && layerOverlay.Layers.Count > 0)
            {
                // Get the filter style applied to the drawing Overlay.
                FilterStyle filterStyle = ((FeatureLayer)layerOverlay.Layers[0]).ZoomLevelSet.ZoomLevel01.CustomStyles[0] as FilterStyle;
                if (filterStyle != null)
                {
                    filterStyle.Conditions.Clear();

                    // Create the filter expression based on the values from client side.
                    string          expression      = string.Format("{0}{1}{2}", filterExpressions[filterExpression].Item1, filterValue, filterExpressions[filterExpression].Item2);
                    FilterCondition filterCondition = new FilterCondition("Population", expression);
                    filterStyle.Conditions.Add(filterCondition);
                }
            }

            return(layerOverlay);
        }
        public void UpdateTextStyle(string overlayId, string accessId, [FromBody] string postData)
        {
            // Deserialize the style in JSON format passed from client side.
            Dictionary <string, string> styles = JsonConvert.DeserializeObject <Dictionary <string, string> >(postData);

            // Save the updated labeling style to tempoary folder for a specific acess id,
            // as the WebAPI service is a REST service, which is stateless. More infomation,
            // please visit http://en.wikipedia.org/wiki/Representational_state_transfer.
            OverlayBuilder.SaveLabelStyle(overlayId, styles, accessId);
        }
        public Dictionary <string, object> GetStyle(string overlayId, string accessId)
        {
            // Get layerOverlay specified by the access id passed from client side.
            LayerOverlay layerOverlay = GetLabelingOverlay(overlayId, accessId);

            Dictionary <string, object> styles = new Dictionary <string, object>();

            switch (overlayId)
            {
            case "LabelStyling":
                styles = OverlayBuilder.GetLabelingStyle(layerOverlay);
                break;

            case "LabelingPoints":
                styles = OverlayBuilder.GetLabelingPointStyle(layerOverlay);
                break;

            case "LabelingLines":
                styles = OverlayBuilder.GetLabelingLineStyle(layerOverlay);
                break;

            case "LabelingPolygons":
                styles = OverlayBuilder.GetLabelingPolygonStyle(layerOverlay);
                break;

            case "CustomLabeling":
                styles = OverlayBuilder.GetCustomLabelingStyle(layerOverlay);
                break;

            default:
                break;
            }

            // Return the style defination in JSON saved on server side to client side.
            return(styles);
        }
Esempio n. 6
0
        static VisualizationController()
        {
            cachedOverlays = new Dictionary <string, LayerOverlay>()
            {
                { "HeatStyle", OverlayBuilder.GetOverlayWithHeatStyle() },
                { "ClassBreakStyle", OverlayBuilder.GetOverlayWithClassBreakStyle() },
                { "DotDensityStyle", OverlayBuilder.GetOverlayWithDotDensityStyle() },
                { "IsolineStyle", OverlayBuilder.GetOverlayWithIsoLineStyle() },
                { "ClusterStyle", OverlayBuilder.GetOverlayWithClusterPointStyle() },
                { "ZedGraphStyle", OverlayBuilder.GetOverlayWithZedGraphStyle() },
                { "IconStyle", OverlayBuilder.GetOverlayWithIconStyle() },
                { "CustomStyle", OverlayBuilder.GetOverlayWithCustomeStyle() }
            };

            filterExpressions = new Dictionary <string, Tuple <string, string> >()
            {
                { "GreaterThanOrEqualTo", new Tuple <string, string>(">=", string.Empty) },
                { "GreaterThan", new Tuple <string, string>(">", string.Empty) },
                { "LessThanOrEqualTo", new Tuple <string, string>("<=", string.Empty) },
                { "LessThan", new Tuple <string, string>("<", string.Empty) },
                { "Equal", new Tuple <string, string>("^", "$") },
                { "DoesNotEqual", new Tuple <string, string>("^(?!", ").*?$") }
            };
        }