public InfoGeometry(IGeometry geometry, StyleSpecification styleSpecification, MapCore map, EnhancedMapLayer layer) : base(geometry, styleSpecification, map, layer) { //must have at least one EnhancedMapPoint to show label and launch balloon. foreach (var mapObject in mapObjects) { if (mapObject is EnhancedMapPoint) { var mapPoint = (EnhancedMapPoint)mapObject; if (mainPoint == null) { mainPoint = mapPoint; } mapPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs { LayerID = layer.ID, ItemID = ItemID }); } } if (mainPoint == null) { //TODO: create one, invisible at centre of first object var point = geometry.Centroid; mainPoint = createPoint(point, layer); mainPoint.Balloon += (o, e) => Balloon(this, new BalloonEventArgs { LayerID = layer.ID, ItemID = ItemID }); } Selected += InfoGeometry_Selected; }
protected EnhancedMapPoint createPoint(IGeometry point, MapLayerBase layer) { var location = CoordinateConvertor.ConvertBack(point.Coordinate); var mapPoint = new EnhancedMapPoint(location, mapInstance) { GeometryStyle = StyleSpecification }; layer.AddChild(mapPoint, location); mapObjects.Add(mapPoint); mapPoint.Visibility = Visibility; return(mapPoint); }
protected EnhancedMapPoint createPoint(IGeometry point, MapLayerBase layer) { var location = CoordinateConvertor.ConvertBack(point.Coordinate); var mapPoint = new EnhancedMapPoint(location, mapInstance) { GeometryStyle = StyleSpecification }; layer.AddChild(mapPoint, location); mapObjects.Add(mapPoint); mapPoint.Visibility = Visibility; return mapPoint; }