コード例 #1
0
        public JsonResult GetTrackFeatures(Map map, GeoCollection <object> args)
        {
            string featuresInJson = string.Empty;

            if (map != null)
            {
                // convert wkt to thinkgeo features
                Feature[] trackedFeatrues = args.Select((t) =>
                {
                    return(new Feature(t.ToString()));
                }).OfType <Feature>().ToArray();

                // add those features into edit overlay
                map.EditOverlay.Features.Clear();
                foreach (Feature item in trackedFeatrues)
                {
                    map.EditOverlay.Features.Add(item);
                }

                // restore other query conditions from session.
                Collection <EarthquakeQueryConfiguration> queryConfigurations = new Collection <EarthquakeQueryConfiguration>();
                if (Session["QueryConfiguration"] != null)
                {
                    queryConfigurations = Session["QueryConfiguration"] as Collection <EarthquakeQueryConfiguration>;
                }

                Collection <Feature> selectedFeatures = FilterEarthquakePoints(map, queryConfigurations);
                featuresInJson = InternalHelper.ConvertFeaturesToJson(selectedFeatures);
            }
            return(Json(new { features = featuresInJson }));
        }
コード例 #2
0
        public string GetLengthOfFeature(Map map, GeoCollection <object> args)
        {
            PointShape point = new PointShape(Convert.ToDouble(args[0]), Convert.ToDouble(args[1]));

            FeatureLayer         worldLayer  = (FeatureLayer)map.StaticOverlay.Layers["RoadLayer"];
            InMemoryFeatureLayer streetLayer = (InMemoryFeatureLayer)map.DynamicOverlay.Layers["StreetLayer"];

            streetLayer.InternalFeatures.Clear();

            worldLayer.Open();
            Collection <Feature> selectedFeatures = worldLayer.QueryTools.GetFeaturesNearestTo(point, GeographyUnit.DecimalDegree, 1, new string[1] {
                "FENAME"
            });

            worldLayer.Close();

            string popupContentHtml = string.Empty;

            if (selectedFeatures.Count > 0)
            {
                LineBaseShape lineShape   = (LineBaseShape)selectedFeatures[0].GetShape();
                double        length      = lineShape.GetLength(GeographyUnit.DecimalDegree, DistanceUnit.Meter);
                string        contentHtml = "<span style='color:red'>{0}</span> has a length of <span style='color:red'>{1:N0}</span> meters.";
                string        information = string.Format(contentHtml, selectedFeatures[0].ColumnValues["FENAME"].Trim(), length);
                popupContentHtml = "<div style='font-size:10px; font-family:verdana; padding:4px;'>" + information + "</div>";

                streetLayer.InternalFeatures.Add("Street", new Feature(lineShape));
            }

            return(popupContentHtml);
        }
コード例 #3
0
        public void SwitchMapType(Map map, GeoCollection <object> args)
        {
            if (map != null)
            {
                string mapType = args[0].ToString();

                LayerOverlay earthquakeOverlay = map.CustomOverlays["EarthquakeOverlay"] as LayerOverlay;
                foreach (Layer layer in earthquakeOverlay.Layers)
                {
                    layer.IsVisible = false;
                }
                Layer selectedLayer = earthquakeOverlay.Layers[mapType];
                selectedLayer.IsVisible = true;
                earthquakeOverlay.Redraw();

                // if Isoline layer, then display its legend.
                if (mapType.Equals("IsoLines Map"))
                {
                    map.AdornmentOverlay.Layers["IsoLineLevelLegendLayer"].IsVisible = true;
                }
                else
                {
                    map.AdornmentOverlay.Layers["IsoLineLevelLegendLayer"].IsVisible = false;
                }
            }
        }
コード例 #4
0
        public string ConvertWkt(Map map, GeoCollection <object> args)
        {
            InMemoryFeatureLayer mapShapeLayer = (InMemoryFeatureLayer)(((LayerOverlay)map.CustomOverlays[1]).Layers["InMemoryFeatureLayer"]);
            string btnConvertText = args[0].ToString();
            string txtWKTText     = args[1].ToString();

            if (btnConvertText == "WKT  to  Feature")
            {
                Feature feature = new Feature(txtWKTText);

                mapShapeLayer.InternalFeatures.Add("feature", feature);

                txtWKTText = string.Empty;
            }
            else
            {
                txtWKTText = mapShapeLayer.InternalFeatures["feature"].GetWellKnownText();

                mapShapeLayer.InternalFeatures.Clear();
            }

            ((LayerOverlay)map.CustomOverlays[1]).Redraw();

            return(txtWKTText);
        }
コード例 #5
0
        public string GetCurrentPosition()
        {
            if (vehicles == null)
            {
                ReadVehicles();
            }

            GeoCollection <JsonVehicle> jsonVehicles = new GeoCollection <JsonVehicle>();

            for (int i = 0; i < 6; i++)
            {
                string            vehicleId = (i + 1).ToString(CultureInfo.InvariantCulture);
                List <PointShape> locations = vehicles[vehicleId];

                readIndex[i]++;
                if (readIndex[i] >= locations.Count)
                {
                    readIndex[i] = 0;
                }

                PointShape  location = locations[readIndex[i]];
                JsonVehicle vehicle  = new JsonVehicle(vehicleId, "vehicle_van_" + (i + 1) + ".png", location.X, location.Y);

                jsonVehicles.Add(vehicle);
            }

            return(Serialize <Collection <JsonVehicle> >(jsonVehicles));
        }
コード例 #6
0
        public void ChangeTheColor(Map map, GeoCollection <object> args)
        {
            if (null != map)
            {
                FeatureLayer worldLayer = (ShapeFileFeatureLayer)map.StaticOverlay.Layers["WorldLayer"];

                string color = args[0] as string;

                switch (color)
                {
                case "yellow":
                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.StandardColors.LightGoldenrodYellow;
                    break;

                case "gray":
                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Gray;
                    break;

                case "green":
                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.StandardColors.LightGreen;
                    break;

                case "black":
                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Black;
                    break;
                }
            }
        }
コード例 #7
0
        public void SimplifyClick(Map map, GeoCollection <object> args)
        {
            if (null == areaBaseShape)
            {
                areaBaseShape = ((InMemoryFeatureLayer)map.StaticOverlay.Layers["SimplificationLayer"]).InternalFeatures[0].GetShape() as AreaBaseShape;
            }
            string toleranceString                   = args[0] as string;
            string simplificationTypeString          = args[1] as string;
            InMemoryFeatureLayer simplificationLayer = (InMemoryFeatureLayer)map.StaticOverlay.Layers["SimplificationLayer"];

            double             tolerance          = Convert.ToDouble(toleranceString, CultureInfo.InvariantCulture);
            SimplificationType simplificationType = SimplificationType.DouglasPeucker;

            switch (simplificationTypeString)
            {
            case "TopologyPreserving":
                simplificationType = SimplificationType.TopologyPreserving;
                break;

            case "DouglasPeucker":
                simplificationType = SimplificationType.DouglasPeucker;
                break;
            }

            MultipolygonShape multipolygonShape = areaBaseShape.Simplify(tolerance, simplificationType);

            simplificationLayer.InternalFeatures.Clear();
            simplificationLayer.InternalFeatures.Add(new Feature(multipolygonShape));
        }
コード例 #8
0
        private void btnUnion_Click(object sender, RoutedEventArgs e)
        {
            InMemoryFeatureLayer inMemoryLayer = (InMemoryFeatureLayer)wpfMap1.FindFeatureLayer("InMemoryFeatureLayer");

            if (inMemoryLayer.InternalFeatures.Count > 1)
            {
                GeoCollection<AreaBaseShape> areaBaseShapes = new GeoCollection<AreaBaseShape>();

                GeoCollection<Feature> features = inMemoryLayer.InternalFeatures;
                foreach (Feature feature in features)
                {
                    AreaBaseShape targetAreaBaseShape = feature.GetShape() as AreaBaseShape;
                    if (targetAreaBaseShape != null)
                    {
                        areaBaseShapes.Add(targetAreaBaseShape);
                    }
                }

                AreaBaseShape unionedAreaBaseShape = AreaBaseShape.Union(areaBaseShapes);
                unionedAreaBaseShape.Id = "UnionedFeature";
                inMemoryLayer.InternalFeatures.Clear();
                inMemoryLayer.InternalFeatures.Add("UnionedFeature", new Feature(unionedAreaBaseShape));
                inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.SimpleColors.Green);

                wpfMap1.Overlays["InMemoryOverlay"].Refresh();
            }
        }
コード例 #9
0
        public ActionResult DrawUsingZedGraphStyle(Map map, GeoCollection <object> args)
        {
            if (null == map)
            {
                map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510);
                map.CurrentExtent = new RectangleShape(-123.41875, 41.96396484375, -107.158984375, 30.36240234375);
                map.MapUnit       = GeographyUnit.DecimalDegree;

                WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay();
                map.CustomOverlays.Add(worldMapKitOverlay);

                //Create our Zedgraph Sytle and wire up the event.
                ZedGraphStyle zedGraphStyle = new ZedGraphStyle();
                zedGraphStyle.ZedGraphDrawing += new EventHandler <ZedGraphDrawingEventArgs>(zedGraphStyle_ZedGraphDrawing);

                zedGraphStyle.RequiredColumnNames.Add("WHITE");
                zedGraphStyle.RequiredColumnNames.Add("ASIAN");
                zedGraphStyle.RequiredColumnNames.Add("AREANAME");

                ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cities_a.shp"));
                citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(zedGraphStyle);
                citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(WorldStreetsTextStyles.GeneralPurpose("AREANAME", 8));
                citiesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                LayerOverlay staticOverlay = new LayerOverlay();
                staticOverlay.Layers.Add("Cities", citiesLayer);
                staticOverlay.IsBaseOverlay = false;
                map.CustomOverlays.Add(staticOverlay);
                currentMap = map;
            }

            return(View(map));
        }
コード例 #10
0
        private void btnUnion_Click(object sender, RoutedEventArgs e)
        {
            InMemoryFeatureLayer inMemoryLayer = (InMemoryFeatureLayer)mapView.FindFeatureLayer("InMemoryFeatureLayer");

            if (inMemoryLayer.InternalFeatures.Count > 1)
            {
                GeoCollection <AreaBaseShape> areaBaseShapes = new GeoCollection <AreaBaseShape>();

                GeoCollection <Feature> features = inMemoryLayer.InternalFeatures;
                foreach (Feature feature in features)
                {
                    AreaBaseShape targetAreaBaseShape = feature.GetShape() as AreaBaseShape;
                    if (targetAreaBaseShape != null)
                    {
                        areaBaseShapes.Add(targetAreaBaseShape);
                    }
                }

                AreaBaseShape unionedAreaBaseShape = AreaBaseShape.Union(areaBaseShapes);
                unionedAreaBaseShape.Id = "UnionedFeature";
                inMemoryLayer.InternalFeatures.Clear();
                inMemoryLayer.InternalFeatures.Add("UnionedFeature", new Feature(unionedAreaBaseShape));
                inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillBrush = new GeoSolidBrush(GeoColor.FromArgb(100, GeoColors.Green));

                mapView.Overlays["InMemoryOverlay"].Refresh();
            }
        }
コード例 #11
0
        public string ConvertWkb(Map map, GeoCollection <object> args)
        {
            InMemoryFeatureLayer mapShapeLayer = (InMemoryFeatureLayer)(((LayerOverlay)map.CustomOverlays[1]).Layers["InMemoryFeatureLayer"]);
            string btnConvertText = args[0].ToString();
            string txtWKBText     = args[1].ToString();

            if (btnConvertText == "WKB  to  Feature")
            {
                byte[]  wellKnownBinary = Convert.FromBase64String(txtWKBText);
                Feature feature         = new Feature(wellKnownBinary);

                mapShapeLayer.InternalFeatures.Add("feature", feature);

                txtWKBText = string.Empty;
            }
            else
            {
                byte[] wellKnownBinary = mapShapeLayer.InternalFeatures["feature"].GetWellKnownBinary();

                mapShapeLayer.InternalFeatures.Clear();

                txtWKBText = Convert.ToBase64String(wellKnownBinary);
            }

            ((LayerOverlay)map.CustomOverlays[1]).Redraw();

            return(txtWKBText);
        }
コード例 #12
0
 private void Initialize(IEnumerable <Plugin> discoveredPlugins)
 {
     this.discoveredPlugins = new GeoCollection <Plugin>();
     foreach (var plugin in discoveredPlugins.OrderBy(p => p.Name))
     {
         this.discoveredPlugins.Add(plugin.Id, plugin);
     }
 }
コード例 #13
0
 public static void LoadFrom <T>(this GeoCollection <T> sourceCollection, GeoCollection <T> targetCollection)
 {
     sourceCollection.Clear();
     foreach (var key in targetCollection.GetKeys())
     {
         sourceCollection.Add(key, targetCollection[key]);
     }
 }
コード例 #14
0
        public string HideZones(Map map, GeoCollection <object> args)
        {
            LayerOverlay     staticOverlay           = (LayerOverlay)map.CustomOverlays["StaticOverlay"];
            RestrictionLayer currentRestrictionLayer = (RestrictionLayer)staticOverlay.Layers["RestrictionLayer"];

            currentRestrictionLayer.RestrictionMode = RestrictionMode.HideZones;
            return("You can not see Africa because we have added a RestrictionLayer and its mode is HideZones.");
        }
コード例 #15
0
        public void ClickEvent(Map map, GeoCollection <object> args)
        {
            PointShape position = new PointShape(Convert.ToDouble(args[0]), Convert.ToDouble(args[1]));

            InMemoryMarkerOverlay markerOverlay = (InMemoryMarkerOverlay)map.CustomOverlays["MarkerOverlay"];

            markerOverlay.FeatureSource.InternalFeatures.Add("marker" + Guid.NewGuid().ToString(), new Feature(position));
        }
コード例 #16
0
 public void ShowRotation(Map map, GeoCollection <object> args)
 {
     if (null != map)
     {
         InMemoryMarkerOverlay markerOverlay = (InMemoryMarkerOverlay)map.CustomOverlays["MarkerOverlay"];
         markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.RotationAngle += 30;
     }
 }
コード例 #17
0
        public JsonResult SaveFences(Map map, GeoCollection <object> args)
        {
            string result = string.Empty;
            Collection <JsonFeature> jsonFeatures = Newtonsoft.Json.JsonConvert.DeserializeObject <Collection <JsonFeature> >(args[0].ToString());

            result = string.Empty + SaveSpatialFences(map, jsonFeatures);
            return(Json(new { status = result }));
        }
コード例 #18
0
        public void SpatialQuery(Map map, GeoCollection <object> args)
        {
            LayerOverlay          staticOverlay           = (LayerOverlay)map.CustomOverlays["StaticOverlay"];
            ShapeFileFeatureLayer worldLayer              = (ShapeFileFeatureLayer)staticOverlay.Layers["WorldLayer"];
            InMemoryFeatureLayer  rectangleLayer          = (InMemoryFeatureLayer)staticOverlay.Layers["RectangleLayer"];
            InMemoryFeatureLayer  spatialQueryResultLayer = (InMemoryFeatureLayer)staticOverlay.Layers["SpatialQueryResultLayer"];

            Feature rectangleFeature = rectangleLayer.InternalFeatures["Rectangle"];
            Collection <Feature> spatialQueryResults;
            string spatialQueryType = args[0].ToString();

            worldLayer.Open();
            switch (spatialQueryType)
            {
            case "Within":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesWithin(rectangleFeature, new string[0]);
                break;

            case "Containing":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesContaining(rectangleFeature, new string[0]);
                break;

            case "Disjointed":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesDisjointed(rectangleFeature, new string[0]);
                break;

            case "Intersecting":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesIntersecting(rectangleFeature, new string[0]);
                break;

            case "Overlapping":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesOverlapping(rectangleFeature, new string[0]);
                break;

            case "TopologicalEqual":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesTopologicalEqual(rectangleFeature, new string[0]);
                break;

            case "Touching":
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesTouching(rectangleFeature, new string[0]);
                break;

            default:
                spatialQueryResults = worldLayer.QueryTools.GetFeaturesWithin(rectangleFeature, new string[0]);
                break;
            }
            worldLayer.Close();

            spatialQueryResultLayer.InternalFeatures.Clear();
            spatialQueryResultLayer.Open();
            foreach (Feature feature in spatialQueryResults)
            {
                spatialQueryResultLayer.InternalFeatures.Add(feature.Id, feature);
            }
            spatialQueryResultLayer.Close();
            staticOverlay.Redraw();
        }
コード例 #19
0
        public string ClickEvent(Map map, GeoCollection <object> args)
        {
            double x = Convert.ToDouble(args[0]);
            double y = Convert.ToDouble(args[1]);

            PointShape location = new PointShape(x, y);

            return("<span class='popup'>Inside the area</span>");
        }
コード例 #20
0
        public void RotateClockwise(Map map, GeoCollection <object> args)
        {
            RotationProjection rotateProjection = (RotationProjection)((FeatureLayer)map.StaticOverlay.Layers[0]).FeatureSource.Projection;

            rotateProjection.Angle -= 45;

            //Map1.StaticOverlay.ClientCache.CacheId = rotateProjection.Angle.ToString();
            //Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ImageCache/" + Request.Path + "/" + rotateProjection.Angle.ToString());
            map.StaticOverlay.Redraw();
        }
コード例 #21
0
        public void SetScaleLineLocation(Map map, GeoCollection <object> args)
        {
            string            placementString = args[0].ToString();
            AdornmentLocation placement;

            switch (placementString)
            {
            case "Center":
                placement = AdornmentLocation.Center;
                break;

            case "CenterLeft":
                placement = AdornmentLocation.CenterLeft;
                break;

            case "CenterRight":
                placement = AdornmentLocation.CenterRight;
                break;

            case "LowerCenter":
                placement = AdornmentLocation.LowerCenter;
                break;

            case "LowerLeft":
                placement = AdornmentLocation.LowerLeft;
                break;

            case "LowerRight":
                placement = AdornmentLocation.LowerRight;
                break;

            case "UpperCenter":
                placement = AdornmentLocation.UpperCenter;
                break;

            case "UpperLeft":
                placement = AdornmentLocation.UpperLeft;
                break;

            case "UpperRight":
                placement = AdornmentLocation.UpperRight;
                break;

            default:
                placement = AdornmentLocation.CenterRight;
                break;
            }
            LayerOverlay dynamicOverlay = (LayerOverlay)map.CustomOverlays["DynamicOverlay"];

            ScaleLineAdornmentLayer currentScaleLineAdornmentLayer = (ScaleLineAdornmentLayer)dynamicOverlay.Layers["ScaleLineAdornmentLayer"];

            currentScaleLineAdornmentLayer.Location = placement;
            dynamicOverlay.Redraw();
        }
コード例 #22
0
        private GeoCollection <string> GetFeatureIds(IEnumerable <string> adjacentIds)
        {
            GeoCollection <string> featureIds = new GeoCollection <string>();

            foreach (string item in adjacentIds)
            {
                string featureId = item.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries)[0];
                featureIds.Add(item, featureId);
            }
            return(featureIds);
        }
コード例 #23
0
        public ActionResult DisplayVehicles(Map map, GeoCollection <object> args)
        {
            // Read vehicles from database
            DateTime currentTime = GetAdjustedCurrentDateTime();
            Dictionary <int, Vehicle> vehicles = GetVehicles(map, currentTime);

            // Update vehicle information to Map
            UpdateVehiclesToOverlays(map, vehicles);

            return(View(vehicles.Values.ToList()));
        }
コード例 #24
0
        public string EditShape(Map map, GeoCollection <object> args)
        {
            LayerOverlay         dynamicOverlay = (LayerOverlay)map.CustomOverlays["DynamicOverlay"];
            InMemoryFeatureLayer shapeLayer     = (InMemoryFeatureLayer)dynamicOverlay.Layers["shapeLayer"];

            string featuresJson = MapHelper.ConvertFeaturesToJson(shapeLayer.InternalFeatures);

            shapeLayer.InternalFeatures.Clear();

            return(featuresJson);
        }
コード例 #25
0
        public JsonResult GetCategories(Map map, GeoCollection <object> args)
        {
            // Initialise categories
            Dictionary <string, Collection <string> > poiTypes = new Dictionary <string, Collection <string> >();

            foreach (string layerId in new [] { "Hotels", "Medical Facilites", "Restaurants", "Schools" })
            {
                poiTypes.Add(layerId, GetPoiSubTypes(map.CustomOverlays["PoisOverlay"] as LayerOverlay, layerId));
            }
            // Return the categories in JSON to client side.
            return(Json(poiTypes));
        }
コード例 #26
0
        public string IdentifyFeature(Map map, GeoCollection <object> args)
        {
            string callbackResult = string.Empty;

            if (map != null)
            {
                JsonCallbackRequest callbackRequest = JsonSerializer.Deserialize <JsonCallbackRequest>(args[0].ToString());
                callbackResult = GetIdentifiedFeatureInfo(callbackRequest, map);
            }

            return(callbackResult);
        }
コード例 #27
0
        private void UserControl_Load(object sender, EventArgs e)
        {
            filenames = new GeoCollection <string>();
            filenames.Add("ShortestPath", "ShortestPath");
            filenames.Add("FastestPath", "FastestPath");
            filenames.Add("DallasWithOneWayRoad", "DallasWithOneWayRoad");
            filenames.Add("OptimizeHighway", "OptimizeHighway");
            cmbPurpose.DataSource = filenames.GetKeys();
            RtgRoutingSource.BuildingRoutingData += new EventHandler <BuildingRoutingDataRtgRoutingSourceEventArgs>(RtgRoutingSource_BuildingRoadData);

            RenderMap();
        }
コード例 #28
0
        public void GeographicColorChanged(Map map, GeoCollection <object> args)
        {
            string       geographicColor = args[0] as string;
            GeoColor     areaColor       = GetGeographyColor(geographicColor);
            FeatureLayer worldLayer      = (FeatureLayer)map.StaticOverlay.Layers["WorldLayer"];

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = areaColor;

            //Map1.StaticOverlay.ClientCache.CacheId  = ddlStandardColor.SelectedValue + ddlGeofraphicColor.SelectedValue;
            //Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ImageCache/" + ddlStandardColor.SelectedValue + "/" + ddlGeofraphicColor.SelectedValue);
            map.StaticOverlay.Redraw();
        }
コード例 #29
0
        public string GetCount(Map map, GeoCollection <object> args)
        {
            LayerOverlay staticOverlay = (LayerOverlay)map.CustomOverlays["StaticOverlay"];
            FeatureLayer worldLayer    = (FeatureLayer)staticOverlay.Layers["WorldLayer"];

            worldLayer.Open();
            string result = string.Format("There are <span style='color:red;font-size:15;font-weight:bolder;'>{0}</span> records in this vector layer.", worldLayer.QueryTools.GetCount());

            worldLayer.Close();

            return(result);
        }
コード例 #30
0
        public void SetPointPlacement(Map map, GeoCollection <object> args)
        {
            string         placementString = args[0].ToString();
            PointPlacement placement;

            switch (placementString)
            {
            case "Center":
                placement = PointPlacement.Center;
                break;

            case "CenterLeft":
                placement = PointPlacement.CenterLeft;
                break;

            case "CenterRight":
                placement = PointPlacement.CenterRight;
                break;

            case "LowerCenter":
                placement = PointPlacement.LowerCenter;
                break;

            case "LowerLeft":
                placement = PointPlacement.LowerLeft;
                break;

            case "LowerRight":
                placement = PointPlacement.LowerRight;
                break;

            case "UpperCenter":
                placement = PointPlacement.UpperCenter;
                break;

            case "UpperLeft":
                placement = PointPlacement.UpperLeft;
                break;

            case "UpperRight":
                placement = PointPlacement.UpperRight;
                break;

            default:
                placement = PointPlacement.CenterRight;
                break;
            }
            FeatureLayer labelPlacementLayer = (FeatureLayer)map.DynamicOverlay.Layers["MajorCitiesLabels"];

            labelPlacementLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.PointPlacement = placement;
            map.DynamicOverlay.Redraw();
        }
コード例 #31
0
        public void PlotPoint(Map map, GeoCollection <object> args)
        {
            if (map != null)
            {
                double               x = Convert.ToDouble(args["x"]);
                double               y = Convert.ToDouble(args["y"]);
                LayerOverlay         dynamicOverlay = (LayerOverlay)map.CustomOverlays["DynamicOverlay"];
                InMemoryFeatureLayer shapeLayer     = (InMemoryFeatureLayer)dynamicOverlay.Layers["ShapeLayer"];

                Feature pointFeature = new Feature(new PointShape(x, y));
                shapeLayer.InternalFeatures.Add(pointFeature.Id, pointFeature);
            }
        }