private void SetupMapLayers() { string dir = Directory.GetCurrentDirectory(); string dataPath = "\\..\\..\\..\\data\\geodata\\maps\\"; string fileName = "europe_nation"; ShapeFileReader shapeReader = new ShapeFileReader(); iMapData = shapeReader.Read(dir + dataPath + fileName + ".shp" , dir + dataPath + fileName + ".dbf" , dir + dataPath + fileName + ".shx"); // Border Layer borderLayer = new MapPolygonBorderLayer(); borderLayer.MapData = iMapData; // Polygon Layer polygonLayer = new MapPolygonLayer(); polygonLayer.MapData = iMapData; polygonLayer.ColorMap = iColorMap; polygonLayer.IndexVisibilityHandler = iPcPlot.IndexVisibilityHandler; iPcPlot.FilterChanged += new EventHandler(iPcPlot_FilterChanged); polygonSelectionLayer = new MapPolygonLayer(); polygonSelectionLayer.MapData = iMapData; polygonSelectionLayer.PolygonColor = Color.FromArgb(220, 220, 220); polygonSelectionLayer.Alpha = 120; borderSelectionLayer = new MapPolygonBorderLayer(); borderSelectionLayer.MapData = iMapData; borderSelectionLayer.BorderColor = Color.Black; borderSelectionLayer.Translation = new Vector3(0.6f, 0.6f, 0); // borderSelectionLayer.Translation.X; iSelectedInVisibility = new IndexVisibilityHandler(iMapData.RegionList.Count); iSelectedVisibility = new IndexVisibilityHandler(iMapData.RegionList.Count); iSelectedInVisibility.Clear(); iInVisibilityList = iSelectedInVisibility.CreateVisibilityList(); iVisibilityList = iSelectedVisibility.CreateVisibilityList(); for (int i = 0, endI = iMapData.RegionList.Count; i < endI; i++) { iVisibilityList.SetVisibility(i, 0, false); } polygonSelectionLayer.IndexVisibilityHandler = iSelectedInVisibility; borderSelectionLayer.IndexVisibilityHandler = iSelectedVisibility; // polygonSelectionLayer.SelectedPolygonColor = Color.Transparent; // Glyph Layer glyphLayer = new CountryGlyphLayer(iPanel); glyphLayer.ActiveGlyphPositioner = new CenterGlyphPositioner(); glyphLayer.ActiveGlyphPositioner.MapData = iMapData; glyphLayer.Input = iDataCube; glyphLayer.IndexVisibilityHandler = iPcPlot.IndexVisibilityHandler; // Choropleth Map choroMap = new ChoroplethMap(); choroMap.VizComponentMouseDown += new EventHandler <VizComponentMouseEventArgs>(MouseDown); choroMap.VizComponentMouseUp += new EventHandler <VizComponentMouseEventArgs>(MouseUp); // Add layers on the proper order choroMap.AddLayer(polygonLayer); choroMap.AddLayer(borderLayer); choroMap.AddLayer(polygonSelectionLayer); choroMap.AddLayer(borderSelectionLayer); choroMap.AddLayer(glyphLayer); Invalidate(); //iSelectedColorLegend = new InteractiveColorLegend(); //iSelectedColorLegend.ColorMap = iLegendColorMap; //iSelectedColorLegend.BorderColor = Color.Black; //iSelectedColorLegend.ShowMinMaxValues = false; //iSelectedColorLegend.SetLegendSize(10, 200); //iSelectedColorLegend.SetPosition(50F, 10F); //iSelectedColorLegend.SetLegendSize(0.02f, 0.2f); //iSelectedColorLegend.ShowColorEdgeSliders = false; //iSelectedColorLegend.ShowColorEdgeSliderValue = false; ////iSelectedColorLegend.ColorEdgeValuesChanged += new EventHandler(ColorLegendChanged); //choroMap.AddSubComponent(iSelectedColorLegend); iColorLegend = new InteractiveColorLegend(); iColorLegend.ColorMap = iColorMap; //iColorLegend.BorderColor = Color.Black; //iColorLegend.SliderTextColor = Color.Black; //iColorLegend.ShowMinMaxValues = true; iColorLegend.SetPosition(10, 10); iColorLegend.SetLegendSize(15, 200); iColorLegend.ShowColorEdgeSliders = true; iColorLegend.ShowColorEdgeSliderValue = false; iColorLegend.ColorEdgeValuesChanged += new EventHandler(ColorLegendChanged); //iColorLegend.ShowValueSliders = true; //iColorLegend.ShowValueSliderValue = true; //iColorLegend.ValueSliderValuesChanged += new EventHandler(ColorLegendChanged); //iColorLegend.SetEdgeSliders(InteractiveColorLegend.SliderLinePosition.Center, InteractiveColorLegend.TextPosition.RightOrBottom, true); choroMap.AddSubComponent(iColorLegend); renderer.Add(choroMap, iPanel); }
private void InitializeMap() { //throw new NotImplementedException(); choroplethMap = new ChoroplethMap(); mapBorderLayer = new MapBorderLayer(); mapBorderLayer.MapData = mapData; mapPolygonLayer = new MapPolygonLayer(); mapPolygonLayer.MapData = mapData; mapPolygonLayer.IndexMapper = stringIndexMapper; mapPolygonLayer.ColorMap = colorMap; choroplethMap.Position = new Vector2(0.5f, 0.23f); choroplethMap.Zoom = -(0.75f); choroplethMap.AddLayer(mapPolygonLayer); choroplethMap.AddLayer(mapBorderLayer); choroplethMap.AddSubComponent(interactiveColorLegend); choroplethMap.VizComponentMouseDown += new EventHandler<VizComponentMouseEventArgs>(choroplethMap_VizComponentMouseDown); choroplethMap.VizComponentMouseUp += new EventHandler<VizComponentMouseEventArgs>(choroplethMap_VizComponentMouseUp); choroplethMap.VizComponentMouseMove += new EventHandler<VizComponentMouseEventArgs>(choroplethMap_VizComponentMouseMove); choroplethMap.PositionInternallyChanged += new EventHandler(choroplethMap_PositionInternallyChanged); choroplethMap.ZoomInternallyChanged += new EventHandler(choroplethMap_ZoomInternallyChanged); }