private void mapControl_MouseDown(object sender, MouseButtonEventArgs e) { if (Keyboard.Modifiers == ModifierKeys.Shift) { GeoPoint centerPoint = vectorLayer.ScreenToGeoPoint(e.GetPosition(vectorLayer)); double radius = (double)seRadius.Value; MapDot dot = new MapDot() { Location = centerPoint }; dot.Size = 6; itemsStorage.Items.Add(dot); MapEllipse defaultEllipse = MapEllipse.CreateByCenter(mapControl.CoordinateSystem, centerPoint, radius * 2, radius * 2); defaultEllipse.Fill = Brushes.Transparent; defaultEllipse.Stroke = Brushes.White; itemsStorage.Items.Add(defaultEllipse); MapPolyline equalDistance = new EquidistantCircleCreator(vectorLayer).CreateCircle(centerPoint, radius); equalDistance.Stroke = Brushes.GreenYellow; itemsStorage.Items.Add(equalDistance); MapPolyline ScreenCircle = new ScreenCircleCreator(vectorLayer).CreateCircle(centerPoint, radius); ScreenCircle.Stroke = Brushes.Red; itemsStorage.Items.Add(ScreenCircle); } }
public void SetUp(MapDot dot) { labelText = transform.Find("Label/LabelText"); actionItem1 = transform.Find("Action1"); actionText1 = transform.Find("Action1/ActionText1"); actionText1.renderer.material.renderQueue = 4000; actionText1.gameObject.AddComponent<InputRepeater>().SetTarget(dot.transform); actionItem2 = transform.Find("Action2"); actionText2 = transform.Find("Action2/ActionText2"); actionText2.renderer.material.renderQueue = 4000; actionText2.gameObject.AddComponent<InputRepeater>().SetTarget(dot.transform); SetUnSelected(); }
MapVectorItemCollection ClusterizeImpl(MapVectorItemCollection sourceItems) { // Separate localizable and non localizable items. List <MapItem> nonLocalizableItems = new List <MapItem>(); List <Cluster> clusters = new List <Cluster>(); foreach (MapItem item in sourceItems) { ISupportCoordLocation localizableItem = item as ISupportCoordLocation; if (localizableItem != null) { clusters.Add(Cluster.Initialize(localizableItem)); } else { nonLocalizableItems.Add(item); } } // Arrange initial clusters in increasing order of distance to a closest cluster. clusters = Arrange(clusters); // Aggregate localizable items. while (clusters.Count > ClusterCount) { MergeCloserstClusters(ref clusters); } // Convert internal cluster helpers to Map items. MapVectorItemCollection clusterRepresentatives = CreateItemsCollection(); for (int i = 0; i < clusters.Count; ++i) { Cluster cluster = clusters[i]; MapDot representative = new MapDot() { Location = new GeoPoint(cluster.CenterPoint.Y, cluster.CenterPoint.X), Size = 100 }; for (int j = 0; j < cluster.Items.Count; ++j) { representative.ClusteredItems.Add(cluster.Items[j] as MapItem); } clusterRepresentatives.Add(representative); } for (int i = 0; i < nonLocalizableItems.Count; ++i) { clusterRepresentatives.Add(nonLocalizableItems[i]); } return(clusterRepresentatives); }
public SCMap AddDot(double[] location, DotOptions options = null) { options ??= new DotOptions(); var mapItem = new MapDot(); if (location == null || location.Length != 2) { throw new Exception("Location must be double array with 2 elements."); } mapItem.Location = CreateCoordPoint(location[0], location[1]); options.ConfigureMapItem(this, mapItem); return(this); }
MapItemCollection ClusterizeImpl(IEnumerable <MapItem> sourceItems) { // Separate localizable and non localizable items. List <MapItem> nonLocalizableItems = new List <MapItem>(); List <Cluster> clusters = new List <Cluster>(); foreach (MapItem item in sourceItems) { ISupportCoordLocation localizableItem = item as ISupportCoordLocation; if (localizableItem != null) { clusters.Add(Cluster.Initialize(localizableItem)); } else { nonLocalizableItems.Add(item); } } // Arrange initial clusters in increasing order of distance to a closest cluster. clusters = Arrange(clusters); // Aggregate localizable items. while (clusters.Count > ClusterCount) { MergeCloserstClusters(ref clusters); } // Convert internal cluster helpers to Map items. MapItemCollection clusterRepresentatives = new MapItemCollection(owner); for (int i = 0; i < clusters.Count; ++i) { Cluster cluster = clusters[i]; MapDot representative = new MapDot() { Location = new GeoPoint(cluster.CenterPoint.Y, cluster.CenterPoint.X), Size = 100 }; representative.ClusteredItems = cluster.Items.Select(item => item as MapItem).ToList(); representative.TitleOptions.Pattern = representative.ClusteredItems.Count.ToString(); clusterRepresentatives.Add(representative); } clusterRepresentatives.AddRange(nonLocalizableItems); return(clusterRepresentatives); }
private void InitializeData() { Ellipse = new MapEllipse { Fill = TransparentBrush, IsHitTestVisible = false, Stroke = ColoredBrush, StrokeStyle = new StrokeStyle() { Thickness = 4 } }; var dot = new MapDot() { Fill = CenterFillBrush, Stroke = TransparentBrush, Size = 20, IsHitTestVisible = false }; CenterMarkers = new List <MapDot>(); CenterMarkers.Add(dot); dot = new MapDot() { Fill = TransparentBrush, Stroke = CenterBorderBrush, Size = 32, StrokeStyle = new StrokeStyle() { Thickness = 5 }, IsHitTestVisible = false }; CenterMarkers.Add(dot); var storage = new MapItemStorage(); storage.Items.Add(Ellipse); foreach (var marker in CenterMarkers) { storage.Items.Add(marker); } this.Data = storage; }
private MapItemStorage LoadDataFromXML(string filePath) { MapItemStorage storage = new MapItemStorage(); // Load an XML document from the specified file path. XDocument document = XDocument.Load(filePath); if (document != null) { foreach (XElement element in document.Element("Capitals").Elements()) { // Specify shapes attributes by loaded from an XML file values. double latitude = Convert.ToDouble(element.Element("Latitude").Value, CultureInfo.InvariantCulture ); double longitude = Convert.ToDouble(element.Element("Longitude").Value, CultureInfo.InvariantCulture ); string name = element.Element("Name").Value; uint population = Convert.ToUInt32(element.Element("Population").Value); MapDot capital = new MapDot() { Location = new GeoPoint(latitude, longitude), Size = 20 }; capital.Attributes.Add(new MapItemAttribute() { Name = "CityName", Type = typeof(string), Value = name }); capital.Attributes.Add(new MapItemAttribute() { Name = "Population", Type = typeof(uint), Value = population }); storage.Items.Add(capital); } } return(storage); }
private void Form1_Load(object sender, System.EventArgs e) { MapItemStorage storage = new MapItemStorage(); VectorItemsLayer layer = new VectorItemsLayer() { Data = storage }; dot = new MapDot() { Size = 100 }; dot.TitleOptions.TextColor = Color.Orange; dot.TitleOptions.TextGlowColor = Color.Black; dot.TitleOptions.Pattern = "{Title}"; dot.Attributes.Add(new MapItemAttribute() { Name = "Title", Value = "Hello,\nI am Dot." }); storage.Items.Add(dot); mapControl1.Layers.Add(layer); }
public void SelectDot(MapDot dot) { if (!IsPlayersTurn()) return; foreach(Transform point in points) point.SendMessage("UnSelect"); dot.Select(); }
public ViewModelMapObject(MapImporter.MapObject obj) { mapitems = new List <MapItem>(); groupname = obj.groupname; name = obj.name; try { altitude = Double.Parse(obj.altitude); } catch (Exception e) { altitude = 0; } active = obj.active; try { startDate = DateTime.Parse(obj.startDate + " " + obj.startTime); } catch (Exception e) { startDate = DateTime.MinValue; } try { endDate = DateTime.Parse(obj.endDate + " " + obj.endTime); } catch (Exception e) { endDate = DateTime.MaxValue; } //Initialize a list of map items List <MapItem> map = new List <MapItem>(); //Convert from Insero's map objects to our foreach (MapImporter.Shape s in obj.shapes) { //Convert circle to DevExpress MapDot if (s is MapImporter.Circle) { MapImporter.Circle circle = (MapImporter.Circle)s; MapDot tempDot = new MapDot(); tempDot.Size = circle.Radius; mapitems.Add(tempDot); } //Convert Polygon to DevExpress Polygon else if (s is MapImporter.Polygon) { MapImporter.Polygon polygon = (MapImporter.Polygon)s; MapPolygon tempPolygon = new MapPolygon(); for (int i = 0; i < polygon.Points.Count; i++) { GeoPoint newGeoPoint = new GeoPoint(); var split = polygon.Points[i].Split(','); newGeoPoint.Latitude = Double.Parse(split[0], System.Globalization.CultureInfo.InvariantCulture); newGeoPoint.Longitude = Double.Parse(split[1], System.Globalization.CultureInfo.InvariantCulture); tempPolygon.Points.Add(newGeoPoint); } mapitems.Add(tempPolygon); } //Convert Polyline to DevExpress Polyline else if (s is MapImporter.Polyline) { MapImporter.Polyline polyline = (MapImporter.Polyline)s; MapPolyline tempPolyline = new MapPolyline(); for (int i = 0; i < polyline.Points.Count; i++) { GeoPoint newGeoPoint = new GeoPoint(); var split = polyline.Points[i].Split(','); newGeoPoint.Latitude = Double.Parse(split[0], System.Globalization.CultureInfo.InvariantCulture); newGeoPoint.Longitude = Double.Parse(split[1], System.Globalization.CultureInfo.InvariantCulture); tempPolyline.Points.Add(newGeoPoint); } mapitems.Add(tempPolyline); } } }
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) { MapDot dot = value as MapDot; return(dot != null ? (int)dot.Size + " dip" : string.Empty); }