本文整理汇总了C#中MapControl类的典型用法代码示例。如果您正苦于以下问题:C# MapControl类的具体用法?C# MapControl怎么用?C# MapControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapControl类属于命名空间,在下文中一共展示了MapControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LineStringEditorCreationWithoutMapControlTest
public void LineStringEditorCreationWithoutMapControlTest()
{
var mapControl = new MapControl();
mapControl.Map.ZoomToFit(new Envelope(new Coordinate(0, 0), new Coordinate(1000, 1000)));
var lineStringEditor = new LineStringInteractor(null, sampleFeature, GetStyle(), null);
Assert.AreEqual(null, lineStringEditor.TargetFeature);
Assert.AreNotEqual(null, lineStringEditor.SourceFeature);
// There are no default focused trackers
var trackers = lineStringEditor.Trackers.Where(t => t.Selected);
Assert.AreEqual(0, trackers.Count());
TrackerFeature tracker = lineStringEditor.Trackers[2];
Assert.AreNotEqual(null, tracker);
Assert.AreEqual(20.0, tracker.Geometry.Coordinates[0].X);
Assert.AreEqual(0.0, tracker.Geometry.Coordinates[0].Y);
lineStringEditor.Start();
lineStringEditor.SetTrackerSelection(tracker, true);
trackers = lineStringEditor.Trackers.Where(t => t.Selected);
Assert.AreEqual(1, trackers.Count());
Assert.AreNotEqual(null, lineStringEditor.TargetFeature);
Assert.AreNotEqual(lineStringEditor.SourceFeature, lineStringEditor.TargetFeature);
}
示例2: addPinsToMap
public void addPinsToMap(MapControl mapControl, Action<MapPin> tappedCallback = null)
{
removePinsFromMap(mapControl);
m_mapPins = new List<MapPin>();
int i = 1;
DB_station prevStation = null;
foreach (List<DB_station> route in m_routes)
{
foreach(DB_station station in route)
{
if (station == prevStation || (station.latitude == 0f && station.longitude == 0f))
continue;
// Title for station.
string title = "Przystanek " + (i++) + "\n" + station.post_id + " " + station.post_name + "\n" + station.street;
// Add pin into map.
var location = new Geopoint(new BasicGeoposition()
{
Latitude = station.latitude,
Longitude = station.longitude
});
MapPin pin = new MapPin(title, station, MapPin.PinType.RegularPin, MapPin.PinSize.Small, tappedCallback);
pin.addToMap(mapControl, location);
m_mapPins.Add(pin);
prevStation = station;
}
}
}
示例3: LayersWindow
public LayersWindow(MapControl mapControl)
{
InitializeComponent();
_mapControl = mapControl;
_model = new ObservableCollection<LayerViewModel>();
if (mapControl.mapBox.Map.Layers != null && mapControl.mapBox.Map.Layers.Count > 0) {
foreach (ILayer layer in mapControl.mapBox.Map.Layers) {
if (layer is VectorLayer) {
_model.Insert(0, new VectorLayerViewModel(layer as VectorLayer));
} else if (layer is MyGdalRasterLayer) {
_model.Insert(0, new RasterLayerViewModel(layer as MyGdalRasterLayer));
}
}
}
lstLayers.ItemsSource = _model;
if (_model.Count > 0) {
lstLayers.SelectedIndex = 0;
}
MapBackColor = mapControl.mapBox.BackColor;
backgroundColorPicker.DataContext = this;
}
示例4: PointMutatorCreationWithoutMapControlTest
public void PointMutatorCreationWithoutMapControlTest()
{
MapControl mapControl = new MapControl();
mapControl.Map.ZoomToBox(new Envelope(new Coordinate(0, 0), new Coordinate(1000, 1000)));
ICoordinateConverter coordinateConverter = new CoordinateConverter(mapControl);
LineStringEditor lineStringMutator = new LineStringEditor(coordinateConverter, null, sampleFeature, GetStyle());
Assert.AreEqual(null, lineStringMutator.TargetFeature);
Assert.AreNotEqual(null, lineStringMutator.SourceFeature);
// There are no default focused trackers
IList<ITrackerFeature> trackers = lineStringMutator.GetFocusedTrackers();
Assert.AreEqual(0, trackers.Count);
ITrackerFeature tracker = lineStringMutator.GetTrackerByIndex(2);
Assert.AreNotEqual(null, tracker);
Assert.AreEqual(20.0, tracker.Geometry.Coordinates[0].X);
Assert.AreEqual(0.0, tracker.Geometry.Coordinates[0].Y);
lineStringMutator.Start();
lineStringMutator.Select(tracker, true);
trackers = lineStringMutator.GetFocusedTrackers();
Assert.AreEqual(1, trackers.Count);
Assert.AreNotEqual(null, lineStringMutator.TargetFeature);
Assert.AreNotEqual(lineStringMutator.SourceFeature, lineStringMutator.TargetFeature);
}
示例5: Start
void Start()
{
GameObject mapControlObj = GameObject.Find("MapControl");
mapControl = mapControlObj.GetComponent<MapControl>();
Transform textBox = transform.Find("UpperLeft/TextBox");
mapControl.SetTextBox(textBox.GetComponent<MapTextBox>());
upperLeft = transform.Find("UpperLeft");
Camera.main.transform.GetComponent<UIManager>().lockToEdge(upperLeft);
upperRight = transform.Find("UpperRight");
Camera.main.transform.GetComponent<UIManager>().lockToEdge(upperRight);
upperRight.gameObject.AddComponent<InputRepeater>().SetTarget(mapControl.transform);
lowerLeft = transform.Find("LowerLeft");
Camera.main.transform.GetComponent<UIManager>().lockToEdge(lowerLeft);
Transform playerName = lowerLeft.Find("PlayerName");
Transform playerScore = lowerLeft.Find("PlayerScore");
lowerRight = transform.Find("LowerRight");
Camera.main.transform.GetComponent<UIManager>().lockToEdge(lowerRight);
Transform enemyName = lowerRight.Find("EnemyName");
Transform enemyScore = lowerRight.Find("EnemyScore");
mapControl.InitScoreboard(playerName, playerScore, enemyName, enemyScore);
}
示例6: SettingsManager
public SettingsManager(ref MapControl MapMain)
{
// Check is the instance doesnt already exist.
if (Current != null)
{
//if there is an instance in the app already present then simply throw an error.
throw new Exception("Only one settings manager can exist in a App.");
}
// Setting the instance to the static instance field.
Current = this;
this.MapMain = MapMain;
ApplicationData.Current.DataChanged += new TypedEventHandler<ApplicationData, object>(DataChangeHandler);
// Roaming Settings
RoamingSettings = ApplicationData.Current.RoamingSettings;
RoamingSettings.CreateContainer("Map", ApplicationDataCreateDisposition.Always);
RoamingSettings.CreateContainer("Appearance", ApplicationDataCreateDisposition.Always);
// Local Settings
LocalSettings = ApplicationData.Current.LocalSettings;
LocalSettings.CreateContainer("Location", ApplicationDataCreateDisposition.Always);
}
示例7: TilesLayer
/// <summary>
/// Creates a new feature layer for visualizing a map based of tiles.
/// </summary>
/// <param name="Id">The unique identification of the layer.</param>
/// <param name="MapControl">The MapControl of the layer.</param>
/// <param name="ZIndex">The Z-Index of the layer.</param>
public TilesLayer(String Id,
MapControl MapControl,
Int32 ZIndex)
: this(Id, ZIndex, MapControl)
{
TilesRefreshTimer = new Timer(TilesAutoRefresh, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(100));
}
示例8: MapControl_OnMapTapped
private void MapControl_OnMapTapped(MapControl sender, MapInputEventArgs args)
{
if (PushPins.Count > 0)
{
MyMapControl.MapElements.Remove(PushPin.Icon);
PushPins.Clear();
}
Geopoint location = args.Location; // Download the complete position of tapped point
//DownloadedLocation = location;
CheckBorders.Check(location);
if (CheckBorders.Check(location) == true)
{
PushPin.SetPosition(MyMapControl, location.Position.Latitude, location.Position.Longitude);
PushPins.Add(PushPin);
}
else
{
MessageBox.ShowMessage("Obszar poza zasięgiem!");
}
}
示例9: MapsViewModel
public MapsViewModel(MapControl mapControl)
{
_mapControl = mapControl;
StopStreetViewCommand = new DelegateCommand(StopStreetView, () => IsStreetView);
StartStreetViewCommand = new DelegateCommand(StartStreetViewAsync, () => !IsStreetView);
if (!DesignMode.DesignModeEnabled)
{
_dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
}
_locator.StatusChanged += async (s, e) =>
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
PositionStatus = e.Status
);
};
// intialize defaults at startup
CurrentPosition = new Geopoint(new BasicGeoposition { Latitude = 48.2, Longitude = 16.3 });
// { Latitude = 47.604, Longitude = -122.329 });
CurrentMapStyle = MapStyle.Road;
DesiredPitch = 0;
ZoomLevel = 12;
}
示例10: ClearSelectionOnParentGroupLayerRemove
public void ClearSelectionOnParentGroupLayerRemove()
{
var featureProvider = new DataTableFeatureProvider();
featureProvider.Add(new WKTReader().Read("POINT(0 0)"));
var layer = new VectorLayer { DataSource = featureProvider };
var groupLayer = new GroupLayer { Layers = { layer } };
using (var mapControl = new MapControl { Map = { Layers = { groupLayer } }, AllowDrop = false })
{
var selectTool = mapControl.SelectTool;
selectTool.Select(featureProvider.Features.Cast<IFeature>());
WindowsFormsTestHelper.Show(mapControl);
mapControl.Map.Layers.Remove(groupLayer);
mapControl.WaitUntilAllEventsAreProcessed();
selectTool.Selection
.Should("selection is cleared on layer remove").Be.Empty();
}
WindowsFormsTestHelper.CloseAll();
}
示例11: myMap_MapTapped_1
private void myMap_MapTapped_1(MapControl sender, MapInputEventArgs args)
{
Debug.WriteLine(args.Location);
messageShown = false;
pinOnMap = true;
Controller.PinPosition = args.Location;
}
示例12: MyMap_MapTapped
private void MyMap_MapTapped(MapControl sender, MapInputEventArgs args)
{
var tappedGeoPosition = args.Location.Position;
var status = "MapTapped at \nLatitude:" + tappedGeoPosition.Latitude + "\nLongitude: " +
tappedGeoPosition.Longitude;
//rootPage.NotifyUser(status, NotifyType.StatusMessage);
}
示例13: GridProfileTool
public GridProfileTool(MapControl mapControl)
: base(mapControl)
{
GridProfiles = new List<IFeature>();
VectorLayer profileLayer = new VectorLayer("Profile Layer")
{
DataSource = new FeatureCollection(GridProfiles, typeof(GridProfile)),
Enabled = true,
Style = new VectorStyle
{
Fill = new SolidBrush (Color.Tomato),
Symbol = null,
Line = new Pen(Color.SteelBlue, 1),
Outline = new Pen(Color.FromArgb(50, Color.LightGray), 3)
},
Map = mapControl.Map,
ShowInTreeView = true
};
Layer = profileLayer;
newLineTool = new NewLineTool(profileLayer)
{
MapControl = mapControl,
Name = "ProfileLine",
AutoCurve = false,
MinDistance = 0,
IsActive = false
};
}
示例14: MapLayer
public MapLayer(MapControl control)
{
_control = control;
_viewModel = _control.ViewModel;
_settings = control.ViewModel.Settings;
_renderBackground = control.ViewModel.Settings.RenderBackground;
}
示例15: CanAddPointToPolygon
public void CanAddPointToPolygon()
{
var mapControl = new MapControl();
var vectorLayer = new VectorLayer();
var layerData = new FeatureCollection();
vectorLayer.DataSource = layerData;
layerData.FeatureType = typeof(CloneableFeature);
layerData.Add(new Polygon(new LinearRing(
new[]
{
new Coordinate(0, 0),
new Coordinate(100, 0),
new Coordinate(100, 100),
new Coordinate(0, 100),
new Coordinate(0, 0),
})));
mapControl.Map.Layers.Add(vectorLayer);
var firstFeature = (IFeature)layerData.Features[0];
mapControl.SelectTool.Select(firstFeature);
var curveTool = mapControl.GetToolByType<CurvePointTool>();
curveTool.IsActive = true;
var args = new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0);
curveTool.OnMouseMove(new Coordinate(50, 0), new MouseEventArgs(MouseButtons.None, 1, 0, 0, 0));
curveTool.OnMouseDown(new Coordinate(50, 0), args);
curveTool.OnMouseUp(new Coordinate(50, 0), args);
Assert.AreEqual(6, firstFeature.Geometry.Coordinates.Length);
Assert.AreEqual(50.0, firstFeature.Geometry.Coordinates[1].X);
}