示例#1
1
        /// <summary>
        /// �޸Ļ�վ��Ϣ����ͼ��Դ�ļ�
        /// </summary>
        /// <param name="f"></param>
        /// <param name="pointCode"></param>
        /// <param name="iType"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="pointname"></param>
        private void ModifyPoint(Feature f, string pointCode, int iType, double x, double y, string pointname, bool IsBusy)
        {
            MapInfo.Geometry.Point g = new MapInfo.Geometry.Point(GetCoordSys(), x, y);
            SimpleVectorPointStyle vs = null;
            MapInfo.Data.Table table = MapInfo.Engine.Session.Current.Catalog.GetTable(strTempMapPointTable);
            //vs = new SimpleVectorPointStyle(34, System.Drawing.Color.Red, 12);

            //��ȡ��վ��ʾЧ��
            vs = GetSimpleVectorPointStyleByiType(iType);

            SimpleLineStyle ls = new SimpleLineStyle(new LineWidth(1, LineWidthUnit.Pixel), 1, System.Drawing.Color.Red);
            SimpleInterior si = new SimpleInterior(1, System.Drawing.Color.Red, System.Drawing.Color.Red);
            AreaStyle a = new AreaStyle(ls, si);
            CompositeStyle cs = new CompositeStyle(a, null, null, vs);
            cs = GetCompositeStyleByIsBusy(IsBusy, iType);

            //Columns cols = new Columns();
            //cols.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("Caption", 50));
            //Feature f = new Feature(g, cs, cols);

            f["Obj"] = g;
            f["MI_Style"] = cs;
            f["ID"] = pointCode;
            f["Caption"] = pointname;
            table.UpdateFeature(f);

            MapInfo.Data.TableInfo tableInfo = table.TableInfo;
            tableInfo.WriteTabFile(); //����Ϊ.tab�ļ�
        }
        private void cmbRestrictionStyle_SelectedIndexChanged(object sender, SelectionChangedEventArgs e)
        {
            if (wpfMap1.Overlays.Count > 0)
            {
                LayerOverlay dynamicOverlay = (LayerOverlay)wpfMap1.Overlays[1];
                RestrictionLayer currentRestrictionLayer = (RestrictionLayer)dynamicOverlay.Layers["RestrictionLayer"];
                if (currentRestrictionLayer.CustomStyles.Count > 0)
                {
                    currentRestrictionLayer.CustomStyles.Clear();
                }

                switch (cmbRestrictionStyle.SelectedItem.ToString().Split(':')[1].Trim())
                {
                    case "HatchPattern":
                        currentRestrictionLayer.RestrictionStyle = RestrictionStyle.HatchPattern;
                        break;
                    case "CircleWithSlashImage":
                        currentRestrictionLayer.RestrictionStyle = RestrictionStyle.CircleWithSlashImage;
                        break;
                    case "UseCustomStyles":
                        currentRestrictionLayer.RestrictionStyle = RestrictionStyle.UseCustomStyles;
                        AreaStyle customStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(150, GeoColor.StandardColors.Gray)));
                        currentRestrictionLayer.CustomStyles.Add(customStyle);
                        break;
                    default:
                        break;
                }

                wpfMap1.Overlays["RestrictionOverlay"].Refresh();
            }
        }
示例#3
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the cityLimits and simplifyLayer layers into a grouped LayerOverlay and display them on the map.
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer cityLimits    = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/FriscoCityLimits.shp"));
            InMemoryFeatureLayer  simplifyLayer = new InMemoryFeatureLayer();
            LayerOverlay          layerOverlay  = new LayerOverlay();

            // Project cityLimits layer to Spherical Mercator to match the map projection
            cityLimits.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Style cityLimits layer
            cityLimits.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray);
            cityLimits.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style simplifyLayer
            simplifyLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray);
            simplifyLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add cityLimits layer to a LayerOverlay
            layerOverlay.Layers.Add("cityLimits", cityLimits);

            // Add simplifyLayer to the layerOverlay
            layerOverlay.Layers.Add("simplifyLayer", simplifyLayer);

            // Set the map extent to the cityLimits layer bounding box
            cityLimits.Open();
            mapView.CurrentExtent = cityLimits.GetBoundingBox();
            cityLimits.Close();

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);

            mapView.Refresh();
        }
示例#4
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.DecimalDegree;
            mapView.CurrentExtent = new RectangleShape(-126.4, 48.8, -67.0, 19.0);

            string connectionString     = "Server=54.177.171.109;Initial Catalog=spatialdatabase;User ID=sa;Password=akeypmon1!";
            SqlServerFeatureLayer layer = new SqlServerFeatureLayer(connectionString, "COUNTRY02", "RECID");

            layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Green, GeoColors.Red);
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay sql2008Overlay = new LayerOverlay();

            sql2008Overlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.ShallowOcean)));
            sql2008Overlay.Layers.Add(layer);
            mapView.Overlays.Add(sql2008Overlay);

            mapView.Refresh();
        }
示例#5
0
        private void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit = GeographyUnit.Meter;

            OsmBuildingOnlineFeatureLayer buildingShapeLayer = new OsmBuildingOnlineFeatureLayer();

            buildingShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.WhiteSmoke, GeoColors.DarkGray);
            buildingShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            buildingShapeLayer.FeatureSource.ProjectionConverter            = new ProjectionConverter(4326, 3857);
            buildingShapeLayer.Open();

            LayerOverlay buildingOverlay = new LayerOverlay();

            buildingOverlay.Layers.Add(buildingShapeLayer);
            mapView.Overlays.Add(buildingOverlay);

            mapView.CurrentExtent = new RectangleShape(1524042.13444618, 6636760.00025701, 1525246.01463038, 6635889.33690951);
            mapView.Refresh();
        }
示例#6
0
        public EditorSetting()
        {
            IsAttributePrompted = true;
            AreaStyle editAreaStyle = new AreaStyle(new GeoPen(GeoColor.StandardColors.Pink, 3));

            editAreaStyle.Name = "Edit Area Style";
            LineStyle editLineStyle = new LineStyle(new GeoPen(GeoColor.FromArgb(255, 0, 0, 255), 3));

            editLineStyle.Name = "Edit Line Style";
            PointStyle editPointStyle = new PointStyle();

            editPointStyle.Name      = "Edit Point Style";
            editPointStyle.SymbolPen = new GeoPen(GeoColor.FromArgb(255, 0, 0, 255), 5);

            editCompositeStyle = new CompositeStyle();
            editCompositeStyle.Styles.Add(editAreaStyle);
            editCompositeStyle.Styles.Add(editLineStyle);
            editCompositeStyle.Styles.Add(editPointStyle);
        }
        public RadiusMearsureTrackInteractiveOverlay(DistanceUnit distanceUnit, GeographyUnit mapUnit)
        {
            DistanceUnit = distanceUnit;
            MapUnit = mapUnit;

            textBlock = new TextBlock();
            textBlock.Visibility = Visibility.Collapsed;
            OverlayCanvas.Children.Add(textBlock);

            PolygonTrackMode = PolygonTrackMode.LineWithFill;
            RenderMode = RenderMode.DrawingVisual;

            areaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2);
            pointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.DarkBlue, 8);
            lineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true);

            SetStylesForInMemoryFeatureLayer(TrackShapeLayer);
            SetStylesForInMemoryFeatureLayer(TrackShapesInProcessLayer);
        }
示例#8
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-14833496, 20037508, 14126965, -20037508);

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            InMemoryFeatureLayer rectangleLayer = new InMemoryFeatureLayer();

            rectangleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(50, 100, 100, 200)));
            rectangleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColors.DarkBlue;
            rectangleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            rectangleLayer.InternalFeatures.Add("Rectangle", new Feature("POLYGON((-5565975 -2273031,-5565975 2273031,5565975 2273031,5565975 -2273031,-5565975 -2273031))", "Rectangle"));

            InMemoryFeatureLayer spatialQueryResultLayer = new InMemoryFeatureLayer();

            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(200, GeoColors.PastelRed)));
            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColors.Red;
            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            LayerOverlay spatialQueryResultOverlay = new LayerOverlay();

            spatialQueryResultOverlay.TileType = TileType.SingleTile;
            spatialQueryResultOverlay.Layers.Add("RectangleLayer", rectangleLayer);
            spatialQueryResultOverlay.Layers.Add("SpatialQueryResultLayer", spatialQueryResultLayer);
            mapView.Overlays.Add("SpatialQueryResultOverlay", spatialQueryResultOverlay);

            mapView.Refresh();
        }
        private void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            //Load the well depth points and depth data from a text file into the dictionary
            //We cache this at the class level to prevent form loading it multiple times
            string wellDepthPointDataFilePath = SampleHelper.Get("GrayCountyIrrigationWellDepths.csv");
            Dictionary <PointShape, double> wellDepthPointData = GetWellDepthPointDataFromCSV(wellDepthPointDataFilePath);

            //Get the current extent since we use that to gerenate the grid.  Of course this is just for
            //the demo and in the real world you can use any extent you like
            RectangleShape currentDrawingExtent = MapUtil.GetDrawingExtent(mapView.CurrentExtent, (float)mapView.ActualWidth, (float)mapView.ActualHeight);

            //Calculate the cell size based on how many rows and columns you specified
            double cellSize = Math.Min(currentDrawingExtent.Width / 4, currentDrawingExtent.Height / 4);

            //Greate the grid definition based on the extent, cell size etc.
            GridDefinition gridDefinition = new GridDefinition(currentDrawingExtent, cellSize, -9999, wellDepthPointData);

            //Generate the grid based on Inverse Distance Weighted interpolation model.  You can define your own model if needed.
            GridCell[,] gridCellMatrix = GridFeatureSource.GenerateGridMatrix(gridDefinition, new InverseDistanceWeightedGridInterpolationModel(2, double.MaxValue));

            //Load a new GridFeatureLayer based on the current grid file
            InMemoryGridFeatureLayer gridFeatureLayer = new InMemoryGridFeatureLayer(gridCellMatrix);

            gridFeatureLayer.Open();
            var currentExtent = gridFeatureLayer.GetBoundingBox();

            gridFeatureLayer.Close();

            gridFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColors.Black);
            gridFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            //Add the grid layer, the grid cells, and the well points to the map
            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(gridFeatureLayer);

            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = currentExtent;
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.Overlays.Add(layerOverlay);
            mapView.Refresh();
        }
        protected override void DrawCore(IEnumerable <Feature> features, GeoCanvas canvas, Collection <SimpleCandidate> labelsInThisLayer, Collection <SimpleCandidate> labelsInAllLayers)
        {
            string    orignalTextColumnName = TextColumnName;
            GeoPen    tempHalo = null;
            AreaStyle tempMask = null;

            if (!IsMaskEnabled && Mask != null)
            {
                tempMask = Mask;
                Mask     = null;
            }
            if (!IsHaloEnabled)
            {
                tempHalo = HaloPen;
                HaloPen  = new GeoPen();
            }

            Collection <Feature> normalFeatures = new Collection <Feature>();

            foreach (var feature in features)
            {
                Feature clonedFeature = new Feature(feature.GetWellKnownBinary(), feature.Id, feature.ColumnValues);
                normalFeatures.Add(clonedFeature);
            }

            if (enableScript && !string.IsNullOrEmpty(labelFunctionsScript))
            {
                normalFeatures = InvokeLabelFunction(normalFeatures);
            }

            base.DrawCore(normalFeatures, canvas, labelsInThisLayer, labelsInAllLayers);

            if (tempHalo != null)
            {
                HaloPen = tempHalo;
            }
            if (tempMask != null)
            {
                Mask = tempMask;
            }
            TextColumnName = orignalTextColumnName;
        }
示例#11
0
        private void Form_Load(object sender, EventArgs e)
        {
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer friscoParks  = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/Parks.shp");
            InMemoryFeatureLayer  snapLayer    = new InMemoryFeatureLayer();
            LayerOverlay          layerOverlay = new LayerOverlay();

            // Project friscoParks layer to Spherical Mercator to match the map projection
            friscoParks.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Style friscoParks layer
            friscoParks.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray);
            friscoParks.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style the splitLayer
            snapLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray);
            snapLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add friscoParks to a LayerOverlay
            layerOverlay.Layers.Add("friscoParks", friscoParks);

            // Add splitLayer to the layerOverlay
            layerOverlay.Layers.Add("snapLayer", snapLayer);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403);

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);

            // Add Toyota Stadium feature to stadiumLayer
            var stadium = new Feature(new PointShape(-10779651.500992451, 3915933.0023557912));

            snapLayer.InternalFeatures.Add(stadium);
        }
示例#12
0
        /// <summary>
        /// Set up the map with the ThinkGeo Cloud Maps overlay
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the map's unit of measurement to meters (Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Create a PopupOverlay to display time zone information based on locations input by the user
            PopupOverlay timezoneInfoPopupOverlay = new PopupOverlay();

            // Add the overlay to the map
            mapView.Overlays.Add("Timezone Info Popup Overlay", timezoneInfoPopupOverlay);

            // Add a new InMemoryFeatureLayer to hold the timezone shapes
            InMemoryFeatureLayer timezonesFeatureLayer = new InMemoryFeatureLayer();

            // Add a style to use to draw the timezone polygons
            timezonesFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            timezonesFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(50, GeoColors.MediumPurple), GeoColors.MediumPurple, 2);

            // Add the layer to an overlay, and add it to the map
            LayerOverlay timezonesLayerOverlay = new LayerOverlay();

            timezonesLayerOverlay.Layers.Add("Timezone Feature Layer", timezonesFeatureLayer);
            mapView.Overlays.Add("Timezone Layer Overlay", timezonesLayerOverlay);

            // Initialize the TimezoneCloudClient with our ThinkGeo Cloud credentials
            timeZoneCloudClient = new TimeZoneCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~");

            // Set the Map Extent
            mapView.CurrentExtent = new RectangleShape(-14269933.09, 6354969.40, -6966221.89, 2759371.58);

            // Get Timezone info for Frisco, TX
            //GetTimeZoneInfo(-10779572.80, 3915268.68);

            mapView.Refresh();
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.CurrentExtent = new RectangleShape(-17336118, 20037508, 11623981, -16888303);
            mapView.MapTools.PanZoomBar.IsEnabled          = true;
            mapView.MapTools.PanZoomBar.DisplayZoomBarText = ZoomBarTextDisplayMode.Display;

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean)));
            worldOverlay.Layers.Add(worldLayer);
            mapView.Overlays.Add(worldOverlay);

            mapView.Refresh();
        }
示例#14
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.DecimalDegree;
            mapView.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean));

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\Countries02.shp");

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.Layers.Add(backgroundLayer);
            worldOverlay.Layers.Add(worldLayer);
            mapView.Overlays.Add(worldOverlay);

            mapView.Refresh();
        }
示例#15
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.CurrentExtent = new RectangleShape(-15963215, 20037508, 12990985, -13516534);
            mapView.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColors.DeepOcean);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.RequiredColumnNames.Add("POP_CNTRY");
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldLayer.DrawingFeatures += new EventHandler <DrawingFeaturesEventArgs>(worldLayer_DrawingFeatures);

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            mapView.Refresh();
        }
示例#16
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(txtInputShapeFile.Text);

            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.LightYellow, GeoColors.Black);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Black, 2, true);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyle.CreateSimpleCircleStyle(GeoColors.Transparent, 7, GeoColors.Black);
            shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            shapeFileFeatureLayer.Open();

            if (shapeFileFeatureLayer.Projection != null)
            {
                shapeFileFeatureLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(shapeFileFeatureLayer.Projection.ProjString, 3857);
                shapeFileFeatureLayer.FeatureSource.ProjectionConverter.Open();
            }

            LayerOverlay shapeFileOverlay = (LayerOverlay)(mapView1.Overlays["shapeFileOverlay"]);

            shapeFileOverlay.TileBuffer = 0;
            shapeFileOverlay.Layers.Add(shapeFileFeatureLayer);

            ThinkGeoMBTilesLayer thinkGeoMBTilesLayer = new ThinkGeoMBTilesLayer(txtMbtilesFilePathname.Text, new Uri(@"./SimpleRenderer.json", UriKind.Relative));
            LayerOverlay         mbtilesOverlay       = (LayerOverlay)(mapView1.Overlays["mbtilesOverlay"]);

            mbtilesOverlay.TileBuffer = 0;
            mbtilesOverlay.Layers.Add(thinkGeoMBTilesLayer);

            mapView1.MapUnit = GeographyUnit.Meter;
            shapeFileFeatureLayer.Open();
            mapView1.CurrentExtent = shapeFileFeatureLayer.GetBoundingBox();

            mapView1.Refresh();

            ckbDisplayShapeFile.Enabled = true;
            ckbDisplayMbtiles.Enabled   = true;

            string jsonFile = File.ReadAllText(@".\SimpleRenderer.json");

            tbxJson.Text = jsonFile;
        }
示例#17
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the friscoParks and selectedAreaLayer layers
        /// into a grouped LayerOverlay and display it on the map.
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer friscoParks       = new ShapeFileFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Shapefile/Parks.shp"));
            InMemoryFeatureLayer  selectedAreaLayer = new InMemoryFeatureLayer();
            LayerOverlay          layerOverlay      = new LayerOverlay();

            // Project friscoParks layer to Spherical Mercator to match the map projection
            friscoParks.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Style friscoParks layer
            friscoParks.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray);
            friscoParks.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style selectedAreaLayer
            selectedAreaLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(64, GeoColors.Green), GeoColors.DimGray);
            selectedAreaLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add friscoParks layer to a LayerOverlay
            layerOverlay.Layers.Add("friscoParks", friscoParks);

            // Add selectedAreaLayer to the layerOverlay
            layerOverlay.Layers.Add("selectedAreaLayer", selectedAreaLayer);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10782307.6877106, 3918904.87378907, -10774377.3460701, 3912073.31442403);

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);

            mapView.Refresh();
        }
示例#18
0
        private void ConfigureBackgroundStyleClick(object sender, RoutedEventArgs e)
        {
            if (viewModel.BackgroundStyle != null)
            {
                viewModel.BackgroundStyle.Name = GisEditor.StyleManager.GetStylePluginByStyle(viewModel.BackgroundStyle).Name;
            }

            if (viewModel.BackgroundStyle != null &&
                viewModel.BackgroundStyle.CustomAreaStyles.Count == 0)
            {
                var tempStyle = new AreaStyle();
                tempStyle.Name = viewModel.BackgroundStyle.Name;
                tempStyle      = (AreaStyle)viewModel.BackgroundStyle.CloneDeep();
                viewModel.BackgroundStyle.CustomAreaStyles.Add(tempStyle);
            }

            StyleBuilderArguments styleArguments = new StyleBuilderArguments();

            styleArguments.AvailableStyleCategories = StyleCategories.Area;
            styleArguments.AvailableUIElements      = StyleBuilderUIElements.StyleList;
            styleArguments.AppliedCallback          = (result) =>
            {
                AreaStyle areaStyle = new AreaStyle();
                foreach (var item in result.CompositeStyle.Styles.OfType <AreaStyle>())
                {
                    areaStyle.CustomAreaStyles.Add(item);
                }
                viewModel.BackgroundStyle = areaStyle;
            };

            AreaStyle style = (AreaStyle)viewModel.BackgroundStyle.CloneDeep();

            style.Name = viewModel.BackgroundStyle.Name;
            var resultStyle = GisEditor.StyleManager.EditStyles(styleArguments, style);

            if (resultStyle != null)
            {
                resultStyle.SetDrawingLevel();
                viewModel.BackgroundStyle = resultStyle;
            }
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit = GeographyUnit.DecimalDegree;

            mapView.CurrentExtent = new RectangleShape(-126.4, 48.8, -67.0, 19.0);

            string connectString = "Server=54.177.171.109;User Id=postgres;Password=akeypmon1;DataBase=spatialdatabase;";
            PostgreSqlFeatureLayer postgreLayer = new PostgreSqlFeatureLayer(connectString, "COUNTRY02", "'RECID'");

            postgreLayer.SchemaName = "public";
            postgreLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            postgreLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay postgreOverlay = new LayerOverlay();

            postgreOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.ShallowOcean)));
            postgreOverlay.Layers.Add("PostgreLayer", postgreLayer);
            mapView.Overlays.Add("PostgreOverlay", postgreOverlay);

            mapView.Refresh();
        }
示例#20
0
        private void SetLayerProperties()
        {
            ShapeFileFeatureLayer shapeLayer = new ShapeFileFeatureLayer(txtPath.Text);

            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Green);
            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = new LineStyle(new GeoPen(GeoColors.Black, 1));
            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyle.CreateSimpleCircleStyle(GeoColors.Red, 5);
            shapeLayer.Open();

            if (isEditing)
            {
                mapPrinterLayer.Layers.RemoveAt(0);
            }
            else
            {
                mapPrinterLayer.SetPosition(500, 500, 0, 0, PrintingUnit.Point);
                mapPrinterLayer.MapExtent = shapeLayer.GetBoundingBox();
            }
            mapPrinterLayer.Layers.Add(shapeLayer);
        }
        public SimpleAreaStylePlugin()
            : base()
        {
            IsDefault       = true;
            Name            = GisEditor.LanguageManager.GetStringResource("SimpleAreaStyleName");
            Description     = GisEditor.LanguageManager.GetStringResource("SimpleAreaStylePluginDescription");
            SmallIcon       = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/styles_simplearea.png", UriKind.RelativeOrAbsolute));
            LargeIcon       = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/styles_simplearea.png", UriKind.RelativeOrAbsolute));
            StyleCategories = StyleCategories.Area;
            Index           = StylePluginOrder.SimpleStyle;

            AreaStyle areaStyle = new AreaStyle
            {
                Name           = GisEditor.LanguageManager.GetStringResource("MapElementsListPluginAreaHeader"),
                FillSolidBrush = new GeoSolidBrush(GeoColor.FromHtml("#C0C0C0")),
                OutlinePen     = new GeoPen(GeoColor.FromHtml("#808080"), 1),
            };

            StyleCandidates.Add(areaStyle);
            areaStyleOption = new StyleSetting(this);
        }
示例#22
0
        private void Form_Load(object sender, EventArgs e)
        {
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer dividedCityLimits = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/FriscoCityLimitsDivided.shp");
            InMemoryFeatureLayer  unionLayer        = new InMemoryFeatureLayer();
            LayerOverlay          layerOverlay      = new LayerOverlay();

            // Project dividedCityLimits layer to Spherical Mercator to match the map projection
            dividedCityLimits.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Style dividedCityLimits layer
            dividedCityLimits.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(128, GeoColors.LightOrange), GeoColors.DimGray, 2);
            dividedCityLimits.ZoomLevelSet.ZoomLevel01.DefaultTextStyle    = TextStyle.CreateSimpleTextStyle("NAME", "Segoe UI", 12, DrawingFontStyles.Bold, GeoColors.Black, GeoColors.White, 2);
            dividedCityLimits.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style unionLayer
            unionLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray, 2);
            unionLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add dividedCityLimits to a LayerOverlay
            layerOverlay.Layers.Add("dividedCityLimits", dividedCityLimits);

            // Add unionLayer to the layerOverlay
            layerOverlay.Layers.Add("unionLayer", unionLayer);

            // Set the map extent to the dividedCityLimits layer bounding box
            dividedCityLimits.Open();
            mapView.CurrentExtent = dividedCityLimits.GetBoundingBox();
            dividedCityLimits.Close();

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);
        }
示例#23
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            project = new ProjectionConverter(3857, 4326);
            project.Open();

            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-15963215, 20037508, 12990985, -13516534);

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer();

            highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyle.CreateCompoundPointStyle(PointSymbolType.Square, GeoColors.White, GeoColors.Black, 1F, 8F, PointSymbolType.Square, GeoColors.Navy, GeoColors.Transparent, 0F, 4F);
            highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(150, 154, 205, 50));
            highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            LayerOverlay dynamicOverlay = new LayerOverlay();

            dynamicOverlay.TileType = TileType.SingleTile;
            dynamicOverlay.Layers.Add("HighlightLayer", highlightLayer);
            mapView.Overlays.Add("HighlightOverlay", dynamicOverlay);

            mapView.MapClick     += new EventHandler <MapClickMapViewEventArgs>(mapView_MapClick);
            mapView.CurrentExtent = new RectangleShape(-14833496, 20037508, 14126965, -20037508);
            mapView.Refresh();
        }
示例#24
0
        private void Form_Load(object sender, EventArgs e)
        {
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;
            ShapeFileFeatureLayer.BuildIndexFile(@"../../../Data/Shapefile/FriscoCityLimits.shp");

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer cityLimits   = new ShapeFileFeatureLayer(@"../../../Data/Shapefile/FriscoCityLimits.shp");
            InMemoryFeatureLayer  scaledLayer  = new InMemoryFeatureLayer();
            LayerOverlay          layerOverlay = new LayerOverlay();

            // Project cityLimits layer to Spherical Mercator to match the map projection
            cityLimits.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Style cityLimits layer
            cityLimits.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Orange), GeoColors.DimGray);
            cityLimits.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Style scaledLayer
            scaledLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(new GeoColor(32, GeoColors.Green), GeoColors.DimGray);
            scaledLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add cityLimits layer to a LayerOverlay
            layerOverlay.Layers.Add("cityLimits", cityLimits);

            // Add scaledLayer to the layerOverlay
            layerOverlay.Layers.Add("scaledLayer", scaledLayer);

            // Set the map extent to the cityLimits layer bounding box
            cityLimits.Open();
            mapView.CurrentExtent = cityLimits.GetBoundingBox();
            cityLimits.Close();

            // Add LayerOverlay to Map
            mapView.Overlays.Add("layerOverlay", layerOverlay);
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit = GeographyUnit.Meter;

            rotateProjection      = new RotationProjectionConverter();
            mapView.CurrentExtent = rotateProjection.GetUpdatedExtent(new RectangleShape(-20037508, 17821912, 20037508, -20037508));

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 233, 232, 214), GeoColor.FromArgb(255, 118, 138, 69));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldLayer.FeatureSource.ProjectionConverter            = rotateProjection;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.TileType = TileType.SingleTile;
            worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColors.DeepOcean)));
            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            mapView.Refresh();
        }
示例#26
0
        private void cbxStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            FeatureLayer worldLayer = winformsMap1.FindFeatureLayer("WorldLayer");
            AreaStyle    areaStyle  = null;

            switch (cbxStyle.Text)
            {
            case "Country1":
                areaStyle = AreaStyles.Country1;
                break;

            case "Country2":
                areaStyle = AreaStyles.Country2;
                break;

            default:
                break;
            }
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = areaStyle;

            winformsMap1.Refresh(winformsMap1.Overlays["WorldOverlay"]);
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.ZoomLevelSet  = new ThinkGeoCloudMapsZoomLevelSet();
            mapView.CurrentExtent = new RectangleShape(-14283508, 20037508, 14676953, -9263005);

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            InMemoryFeatureLayer usInMemoryLayer = new InMemoryFeatureLayer();

            usInMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Image;
            usInMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image     = new GeoImage(SampleHelper.Get(@"United States.png"));
            usInMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel         = ApplyUntilZoomLevel.Level20;
            usInMemoryLayer.InternalFeatures.Add("US", new Feature(-10973875, 4803651, "1"));

            InMemoryFeatureLayer chinaInMemoryLayer = new InMemoryFeatureLayer();

            chinaInMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Image;
            chinaInMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image     = new GeoImage(SampleHelper.Get("China.png"));
            chinaInMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel         = ApplyUntilZoomLevel.Level20;
            chinaInMemoryLayer.InternalFeatures.Add("CHINA", new Feature(11657377, 4089387, "2"));

            LayerOverlay staticOverlay = new LayerOverlay();

            staticOverlay.Layers.Add("WorldLayer", worldLayer);
            staticOverlay.Layers.Add("USInMemoryFeatureLayer", usInMemoryLayer);
            staticOverlay.Layers.Add("ChinaInMemoryFeatureLayer", chinaInMemoryLayer);
            mapView.Overlays.Add(staticOverlay);

            mapView.Refresh();
        }
示例#28
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay to show a basic map
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Set the map's unit of measurement to meters(Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Add Cloud Maps as a background overlay
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10786436, 3918518, -10769429, 3906002);

            LayerOverlay         layerOverlay;
            InMemoryFeatureLayer featureLayer;

            // Create the layer that will store the drawn shapes
            featureLayer = new InMemoryFeatureLayer();

            // Add styles for the layer
            featureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyle.CreateSimpleCircleStyle(GeoColors.Blue, 8, GeoColors.Black);
            featureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle    = LineStyle.CreateSimpleLineStyle(GeoColors.Blue, 4, true);
            featureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Blue, GeoColors.Black);
            featureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add the layer to a LayerOverlay
            layerOverlay = new LayerOverlay();
            layerOverlay.Layers.Add("featureLayer", featureLayer);

            // Add the LayerOverlay to the map
            mapView.Overlays.Add("layerOverlay", layerOverlay);

            // Update instructions
            instructions.Text = "Navigation Mode - The default map state. Allows you to pan and zoom the map with mouse controls.";

            mapView.Refresh();
        }
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit      = GeographyUnit.Meter;
            mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Highlight the countries that are land locked and have a population greater than 10 million
            string           expression             = "(POP_CNTRY>10000000) && (LANDLOCKED=='Y')";
            FleeBooleanStyle landLockedCountryStyle = new FleeBooleanStyle(expression);

            // You can access the static methods on these types.  We use this
            // to access the Convert.Toxxx methods to convert variable types
            landLockedCountryStyle.StaticTypes.Add(typeof(System.Convert));
            // The math class might be handy to include but in this sample we do not use it
            //landLockedCountryStyle.StaticTypes.Add(typeof(System.Math));

            landLockedCountryStyle.ColumnVariables.Add("POP_CNTRY");
            landLockedCountryStyle.ColumnVariables.Add("LANDLOCKED");

            landLockedCountryStyle.CustomTrueStyles.Add(new AreaStyle(new GeoPen(GeoColors.Green, 2), new GeoSolidBrush(GeoColor.FromArgb(100, GeoColors.Green))));
            landLockedCountryStyle.CustomFalseStyles.Add(AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green)));

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"), FileAccess.Read);

            worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(landLockedCountryStyle);
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay worldOverlay = new LayerOverlay();

            worldOverlay.TileType = TileType.SingleTile;
            worldOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add("WorldOverlay", worldOverlay);

            mapView.Refresh();
        }
示例#30
0
        /// <summary>
        /// Setup the map with the ThinkGeo Cloud Maps overlay. Also, add the TAB layer to the map
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // It is important to set the map unit first to either feet, meters or decimal degrees.
            mapView.MapUnit = GeographyUnit.Meter;

            // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service and add it to the map.
            var thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Create a new overlay that will hold our new layer and add it to the map.
            LayerOverlay cityboundaryOverlay = new LayerOverlay();

            mapView.Overlays.Add(cityboundaryOverlay);

            // Create the new layer and set the projection as the data is in srid 2276 and our background is srid 3857 (spherical mercator).
            TabFeatureLayer cityBoundaryLayer = new TabFeatureLayer(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Data/Tab/City_ETJ.tab"));

            cityBoundaryLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);

            // Add the layer to the overlay we created earlier.
            cityboundaryOverlay.Layers.Add("City Boundary", cityBoundaryLayer);

            // Set this so we can use our own styles as opposed to the styles in the file.
            cityBoundaryLayer.StylingType = TabStylingType.StandardStyling;

            // Create an Area style on zoom level 1 and then apply it to all zoom levels up to 20.
            cityBoundaryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColors.Green), GeoColors.Green);
            cityBoundaryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Open the layer and set the map view current extent to the bounding box of the layer.
            cityBoundaryLayer.Open();
            mapView.CurrentExtent = cityBoundaryLayer.GetBoundingBox();

            // Refresh the map.
            mapView.Refresh();
        }
示例#31
0
        /// <summary>
        /// Set up the map with the ThinkGeo Cloud Maps overlay and a feature layer for the reprojected features
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();
            // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("9ap16imkD_V7fsvDW9I8r8ULxgAB50BX_BnafMEBcKg~", "vtVao9zAcOj00UlGcK7U-efLANfeJKzlPuDB9nw7Bp4K4UxU_PdRDg~~", ThinkGeoCloudVectorMapsMapType.Light);

            thinkGeoCloudVectorMapsOverlay.VectorTileCache = new FileVectorTileCache(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cache"), "CloudMapsVector");
            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            // Set the map's unit of measurement to meters (Spherical Mercator)
            mapView.MapUnit = GeographyUnit.Meter;

            // Create a new feature layer to display the shapes we will be reprojecting
            InMemoryFeatureLayer reprojectedFeaturesLayer = new InMemoryFeatureLayer();

            // Add a point, line, and polygon style to the layer. These styles control how the shapes will be drawn
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Star, 24, GeoBrushes.MediumPurple, GeoPens.Purple);
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = LineStyle.CreateSimpleLineStyle(GeoColors.MediumPurple, 6, false);
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = AreaStyle.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColors.MediumPurple), GeoColors.MediumPurple, 2);

            // Apply these styles on all zoom levels. This ensures our shapes will be visible on all zoom levels
            reprojectedFeaturesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add the layer to an overlay
            LayerOverlay reprojectedFeaturesOverlay = new LayerOverlay();

            reprojectedFeaturesOverlay.Layers.Add("Reprojected Features Layer", reprojectedFeaturesLayer);

            // Add the overlay to the map
            mapView.Overlays.Add("Reprojected Features Overlay", reprojectedFeaturesOverlay);

            // Set the map extent
            mapView.CurrentExtent = new RectangleShape(-10798419.605087, 3934270.12359632, -10759021.6785336, 3896039.57306867);

            // Initialize the ProjectionCloudClient with our ThinkGeo Cloud credentials
            projectionCloudClient = new ProjectionCloudClient("FSDgWMuqGhZCmZnbnxh-Yl1HOaDQcQ6mMaZZ1VkQNYw~", "IoOZkBJie0K9pz10jTRmrUclX6UYssZBeed401oAfbxb9ufF1WVUvg~~");

            mapView.Refresh();
        }
示例#32
0
        private void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapView.MapUnit       = GeographyUnit.Meter;
            mapView.CurrentExtent = new RectangleShape(-14833496, 20037508, 14126965, -20037508);

            // Create background world map with vector tile requested from ThinkGeo Cloud Service.
            ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light);

            mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"));

            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle    = AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green));

            LayerOverlay staticOverlay = new LayerOverlay();

            staticOverlay.Layers.Add("WorldLayer", worldLayer);
            mapView.Overlays.Add(staticOverlay);

            mapView.Refresh();
        }
        public static void PredefinedStyleTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            PredefinedStylePicker control = (PredefinedStylePicker)sender;

            control.stylesSource.Clear();
            switch ((PredefinedStyleType)e.NewValue)
            {
            case PredefinedStyleType.Line:
                PropertyInfo[] lineStyleInfos = typeof(LineStyles).GetProperties();
                foreach (var lineStyleInfo in lineStyleInfos)
                {
                    LineStyle         geoLineStyle   = (LineStyle)lineStyleInfo.GetValue(null, null);
                    GeoStyleViewModel geoStyleEntity = new GeoStyleViewModel(lineStyleInfo.Name, geoLineStyle);
                    control.stylesSource.Add(geoStyleEntity);
                }
                break;

            case PredefinedStyleType.Point:
                PropertyInfo[] pointStyleInfos = typeof(PointStyles).GetProperties();
                foreach (var pointStyleInfo in pointStyleInfos)
                {
                    PointStyle        geoPointStyle  = (PointStyle)pointStyleInfo.GetValue(null, null);
                    GeoStyleViewModel geoStyleEntity = new GeoStyleViewModel(pointStyleInfo.Name, geoPointStyle);
                    control.stylesSource.Add(geoStyleEntity);
                }
                break;

            case PredefinedStyleType.Area:
                PropertyInfo[] areaStyleInfos = typeof(AreaStyles).GetProperties();
                foreach (var areaStyleInfo in areaStyleInfos)
                {
                    AreaStyle         geoAreaStyle   = (AreaStyle)areaStyleInfo.GetValue(null, null);
                    GeoStyleViewModel geoStyleEntity = new GeoStyleViewModel(areaStyleInfo.Name, geoAreaStyle);
                    control.stylesSource.Add(geoStyleEntity);
                }
                break;
            }
        }
示例#34
0
        // add geometry to temp layer with hollow style
        private void ShowSearchGeometry(FeatureGeometry g, bool clear)
        {
            if (clear)
            {
                // first clear out any other geometries from table
                (_tempTable as IFeatureCollection).Clear();
            }

            Style s=null;
            if (g is IGenericSurface) // closed geometry, use area style
            {
                s  = new AreaStyle(new SimpleLineStyle(new LineWidth(2, LineWidthUnit.Pixel), 2, Color.Red, false), new SimpleInterior(0));
            }
            else if (g is MapInfo.Geometry.Point)
            {
                s = new SimpleVectorPointStyle(34, Color.Red, 18);
            }
            Feature f = new Feature(g, s);

            // Add feature to temp table
            _tempTable.InsertFeature(f);
        }
        private void AddValueCircleLegendItems(LegendAdornmentLayer legendAdornmentLayer)
        {
            ValueCircleStyle valueCircleStyle = (ValueCircleStyle)CurrentStyleBuilder.GetStyles(mapModel.DefaultFeatureLayer.FeatureSource)[0];

            // Here we generate 4 legend items, with the area of 160, 320, 640 and 1280 square pixels seperately.
            int[] circleAreas = new int[] { 160, 320, 640, 1280 };
            foreach (int circleArea in circleAreas)
            {
                LegendItem legendItem = new LegendItem();
                double radius = Math.Sqrt(circleArea / Math.PI);
                legendItem.ImageStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(valueCircleStyle.InnerColor), new GeoPen(new GeoSolidBrush(valueCircleStyle.OuterColor)), (int)(radius * 2));
                AreaStyle maskStyle = new AreaStyle(new GeoPen(GeoColor.StandardColors.LightGray, 1), new GeoSolidBrush(GeoColor.SimpleColors.Transparent));
                legendItem.ImageMask = maskStyle;
                legendItem.ImageWidth = 48;
                legendItem.TextTopPadding = 16;
                legendItem.TextRightPadding = 5;
                legendItem.BottomPadding = 16;
                legendItem.TopPadding = 16;
                legendItem.RightPadding = 5;

                double drawingRadius = circleArea / valueCircleStyle.DrawingRadiusRatio * valueCircleStyle.BasedScale / valueCircleStyle.DefaultZoomLevel.Scale;
                double ratio = (valueCircleStyle.MaxValidValue - valueCircleStyle.MinValidValue) / (valueCircleStyle.MaxCircleAreaInDefaultZoomLevel - valueCircleStyle.MinCircleAreaInDefaultZoomLevel);
                double resultValue = (drawingRadius - valueCircleStyle.MinCircleAreaInDefaultZoomLevel) * ratio + valueCircleStyle.MinValidValue;

                string text = TextFormatter.GetFormatedStringForLegendItem(valueCircleStyle.ColumnName, resultValue);
                legendItem.TextStyle = new TextStyle(text, new GeoFont("Segoe UI", 10), new GeoSolidBrush(GeoColor.SimpleColors.Black));

                legendAdornmentLayer.LegendItems.Add(legendItem);
            }
        }