public void DoNotRenderLabelsForVectorLayerFeaturesWhenLabelsAreNotVisible() { var featureProvider = new DataTableFeatureProvider(); featureProvider.Add(new WKTReader().Read("POINT(0 0)")); featureProvider.Add(new WKTReader().Read("POINT(100 100)")); var layer = new VectorLayer { DataSource = featureProvider }; // make label layer use delegate so that we can check if it renders var callCount = 0; layer.LabelLayer.LabelStringDelegate = delegate(IFeature feature) { callCount++; return(feature.ToString()); }; var map = new Map { Layers = { layer }, Size = new Size(1000, 1000) }; map.Render(); callCount .Should("labels are not rendered when label layer is not visible").Be.EqualTo(0); }
public void RenderLabelsForVectorLayerFeatures() { var featureProvider = new DataTableFeatureProvider(); featureProvider.Add(new WKTReader().Read("POINT(0 0)")); featureProvider.Add(new WKTReader().Read("POINT(100 100)")); var layer = new VectorLayer { DataSource = featureProvider, LabelLayer = { Visible = true } // set labels on, happens in ThemeEditorDialog }; // make label layer use delegate so that we can check if it renders var callCount = 0; layer.LabelLayer.LabelStringDelegate = delegate(IFeature feature) { callCount++; return(feature.ToString()); }; var map = new Map { Layers = { layer }, Size = new Size(1000, 1000) }; map.Render(); callCount .Should("labels are rendered for 2 features of the vector layer").Be.EqualTo(2); }
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(); }
public void NoExceptionShouldBeThrownWhenZoomLevelIsTooLarge() { var featureProvider = new DataTableFeatureProvider(); featureProvider.Add(new WKTReader().Read("LINESTRING(0 0,80000000 0)")); featureProvider.Add(new WKTReader().Read("POINT(50000000 0)")); var layer = new VectorLayer { DataSource = featureProvider }; var map = new Map { Layers = { layer }, Size = new Size(1000, 1000) }; map.Render(); map.ZoomToFit(new Envelope(50000000, 50000001, 0, 1)); map.Render(); }