User Tools

Site Tools


map_suite_desktop_for_wpf_styles_samples

Wpf Samples

Filter Style Sample for Wpf

This project outlines how to apply the FilterStyle to a layer's display. By using this style, the map will filter the features queried from the source file by checking if a specified column value fits the input condition. This effect can be applied to all the Map Suite products.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/map_suite_desktop_for_wpf) for the details.

Screenshot

View this sample on Github

Friends Network Sample for Wpf

In this WPF project we show how you can create a friends network using a point with a circle symbol. It’s a combination of PointStyle and TextStyle, including a description with a mask that keeps the labels in the same layer. It was originally required by a customer at [http://community.thinkgeo.com/t/label-on-a-circle-with-lot-of-points/8193/6](http://community.thinkgeo.com/t/label-on-a-circle-with-lot-of-points/8193/6), it’s a solution with many applications.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/map_suite_desktop_for_wpf) for the details.

Screenshot

View this sample on Github

Default Value Style Sample for Wpf

In today’s Wpf project, we demonstrate the extensibility of ThinkGeo API by creating a custom Style. Inheriting from ValueStyle, we create a Default Value Style that handles the drawing of features that don’t have a value defined in the ValueStyle. Here we are using a point based layer with PointStyle. Note that the Default ValueStyle would also work with line and polygon based layers.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/map_suite_desktop_for_wpf) for the details.

Screenshot

View this sample on Github

Multiple Dot Density Styles Sample for Wpf

This sample takes a detailed look at the DotDensityStyle. You can combine different DotDensityStyles on one FeatureLayer using different columns. Demographic data are usually well fit to be used with that type of style. Here each dot of a certain color represents 100,000 persons of the same age group by state. Using multiple DotDensityStyles, the dimension of age group demographics is added to the representation of population density.

Note that the PointToValueRatio is used to set how many people a dot is going to represent. For example, if you want a dot to represent 100,000 persons, you set it to 0.00001 (1 / 100000). If you want it to be 500,000 persons, you set it to 0.000002 (1 / 500000).

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/map_suite_desktop_for_wpf) for the details.

Screenshot

View this sample on Github

Weather Line Style Sample for Wpf

In this WPF sample, we learn how to extend LineStyle class to create a style for representing weather fronts, such as cold front, warm front, or occluded front for your weather maps. To achieve that styling a regular LineStyle is used for the front line itself. For symbolizing the type of front an icon is used.

Notice the two handy properties to give you more control: Spacing property to adjust the distance in screen coordinate between each symbol on the line, and Side property to control on what side of the line front the symbols should appear. Of course, as you zoom in and out on the map the spacing between each symbol remain the same as it is set in screen coordinate.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/map_suite_desktop_for_wpf) for the details.

Screenshot

View this sample on Github

Multi Line Labeling Sample for Wpf

For labeling purpose, TextStyle has a property called LabelAllPolygonParts that will label all the parts making up a polygon based feature. Unfortunately, we don’t have an equivalent API for labeling all the parts of a line based feature. But thanks to the flexible framework of Map Suite, we show in this WPF sample how easily you can expand the TextStyle class to allow this labeling capability. Look at the custom class MultiLinetextStyle and how DrawCore function is overridden to have the expected labeling behavior.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/map_suite_desktop_for_wpf) for the details.

Screenshot

View this sample on Github # Weather Line Style Sample for Wpf

### Description

In this WPF sample, we learn how to extend LineStyle class to create a style for representing weather fronts, such as cold front, warm front, or occluded front for your weather maps. To achieve that styling a regular LineStyle is used for the front line itself. For symbolizing the type of front an icon is used.

Notice the two handy properties to give you more control: Spacing property to adjust the distance in screen coordinate between each symbol on the line, and Side property to control on what side of the line front the symbols should appear. Of course, as you zoom in and out on the map the spacing between each symbol remain the same as it is set in screen coordinate.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/thinkgeo_desktop_for_wpf) for the details.

![Screenshot](https://github.com/ThinkGeo/WeatherLineStyleSample-ForWpf.NETCore/blob/master/ScreenShot.png)

### About the Code ```csharp class customGeoImageLineStyle : LineStyle {

  protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, 
           System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInThisLayer,
           System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInAllLayers)
  {
     PointStyle pointStyle = new PointStyle(geoImage);
     foreach (Feature feature in features)
      {
          LineShape lineShape = (LineShape)feature.GetShape();
          lineStyle.Draw(new BaseShape[] { lineShape }, canvas, labelsInThisLayer, labelsInAllLayers);
          double totalDist = 0;
          for (int i = 0; i < lineShape.Vertices.Count - 1; i++)
          {
              PointShape pointShape1 = new PointShape(lineShape.Vertices[i]);
              PointShape pointShape2 = new PointShape(lineShape.Vertices[i + 1]);
              LineShape tempLineShape = new LineShape();
              tempLineShape.Vertices.Add(lineShape.Vertices[i]);
              tempLineShape.Vertices.Add(lineShape.Vertices[i + 1]);
              double angle = GetAngleFromTwoVertices(lineShape.Vertices[i], lineShape.Vertices[i + 1]);
              if (side == SymbolSide.Left)
                  if (angle >= 270) { angle = angle - 180; }
              else
                  if (angle <= 90) { angle = angle + 180; }
              
              pointStyle.RotationAngle = (float)angle;
              float screenDist = ExtentHelper.GetScreenDistanceBetweenTwoWorldPoints(
                          canvas.CurrentWorldExtent,pointShape1, pointShape2, canvas.Width, canvas.Height);
              double currentDist = Math.Round(pointShape1.GetDistanceTo(pointShape2, canvas.MapUnit,
                                                                        DistanceUnit.Meter), 2);
              double worldInterval = (currentDist * spacing) / screenDist;
              while (totalDist <= currentDist)
              {
                  PointShape tempPointShape = tempLineShape.GetPointOnALine(StartingPoint.FirstPoint,
                                                            totalDist, canvas.MapUnit, DistanceUnit.Meter);
                  pointStyle.Draw(new BaseShape[] { tempPointShape }, canvas,
                                                                     labelsInThisLayer, labelsInAllLayers);
                  totalDist = totalDist + worldInterval;
              }
              totalDist = totalDist - currentDist;
           }
      }
  }

} ``` ### Getting Help

[Map Suite Desktop for Wpf Wiki Resources](http://wiki.thinkgeo.com/wiki/thinkgeo_desktop_for_wpf)

[Map Suite Desktop for Wpf Product Description](https://thinkgeo.com/ui-controls#desktop-platforms)

[ThinkGeo Community Site](http://community.thinkgeo.com/)

[ThinkGeo Web Site](http://www.thinkgeo.com)

### About ThinkGeo ThinkGeo is a GIS (Geographic Information Systems) company founded in 2004 and located in Frisco, TX. Our clients are in more than 40 industries including agriculture, energy, transportation, government, engineering, software development, and defense.

# Use Custom Font Symbol With PointStyle for Wpf

### Description In this sample we show you how to use custom font symbol with pointStyle to your Map Suite applications for the WPF environment. The UseCustomFontSymbolWithPointStyle-ForWpf.NETCore sample supports ThinkGeo UI for Wpf 12.0 and higher.

Please refer to [Wiki](http://wiki.thinkgeo.com/wiki/thinkgeo_desktop_for_wpf) for the details.

![Screenshot](https://github.com/ThinkGeo/UseCustomFontSymbolWithPointStyle-ForWpf.NETCore/blob/master/Screenshot.gif)

### About the Code ```csharp ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(“AppData/MajorCities_3857.shp”); citiesLayer.Name = “MajorCities”; citiesLayer.ZoomLevelSet.ZoomLevel04.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 20, DrawingFontStyles.Regular),
                                  "\ue0b5",new GeoSolidBrush(GeoColors.Red));

citiesLayer.ZoomLevelSet.ZoomLevel05.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 25, DrawingFontStyles.Regular),
                                  "\ue05c",new GeoSolidBrush(GeoColors.Orange));

citiesLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 28, DrawingFontStyles.Regular),
                                  "\ue078",new GeoSolidBrush(GeoColors.Green));

citiesLayer.ZoomLevelSet.ZoomLevel07.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 30, DrawingFontStyles.Regular), 
                                  "\ue035",new GeoSolidBrush(GeoColors.DarkBlue));

citiesLayer.ZoomLevelSet.ZoomLevel08.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 34, DrawingFontStyles.Regular),
                                  "\ue02e",new GeoSolidBrush(GeoColors.Blue));

citiesLayer.ZoomLevelSet.ZoomLevel09.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 36, DrawingFontStyles.Regular), 
                                  "\ue06f",new GeoSolidBrush(GeoColors.Purple));

citiesLayer.ZoomLevelSet.ZoomLevel10.DefaultPointStyle = new PointStyle(

                                  new GeoFont("AppData/vectormap-icons.ttf", 40, DrawingFontStyles.Regular),
                                  "\ue084", new GeoSolidBrush(GeoColors.Red));

``` ### Getting Help

[ThinkGeo Desktop for Wpf Wiki Resources](http://wiki.thinkgeo.com/wiki/thinkgeo_desktop_for_wpf)

[ThinkGeo Desktop for Wpf Product Description](https://thinkgeo.com/ui-controls#desktop-platforms)

[ThinkGeo Community Site](http://community.thinkgeo.com/)

[ThinkGeo Web Site](http://www.thinkgeo.com)

### About ThinkGeo ThinkGeo is a GIS (Geographic Information Systems) company founded in 2004 and located in Frisco, TX. Our clients are in more than 40 industries including agriculture, energy, transportation, government, engineering, software development, and defense.

map_suite_desktop_for_wpf_styles_samples.txt · Last modified: 2020/03/08 06:41 (external edit)