public void InitDocument(NDrawingDocument document, NMapProjection mapProjection) { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add the countries shape file NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; mapImporter.AddLayer(countries); // Read the map data mapImporter.Read(); mapImporter.Projection = mapProjection; mapImporter.Parallels.ArcRenderMode = ArcRenderMode.Fine; mapImporter.Meridians.ArcRenderMode = ArcRenderMode.Fine; // Add a fill rule countries.FillRule = new NMapFillRuleValue("ISO_NUM", MapColors); // Import the map mapImporter.Import(document, document.Bounds); // Size the document to content document.SizeToContent(); }
private void LoadMap(NDrawingDocument document, string fileName, string nameColumn, string textColumn, string toolTipColumn, float width, float height) { document.Layers.RemoveAllChildren(); document.Width = width; document.Height = height; NEsriMapImporter mapImporter = new NEsriMapImporter(); // Create the STATES shape file NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(fileName)); countries.NameColumn = nameColumn; countries.TextColumn = textColumn; mapImporter.AddLayer(countries); // Import the map mapImporter.Read(); if (String.IsNullOrEmpty(toolTipColumn) == false) { mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(toolTipColumn); } mapImporter.Import(document, document.Bounds); document.SizeToContent(); }
public void InitDocument(NDrawingDocument document, NDataGrouping dataGrouping) { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; mapImporter.AddLayer(countries); mapImporter.Read(); // Load the data DataSet dataSet = new DataSet(); dataSet.ReadXml(HttpContext.Current.Server.MapPath(SalesXmlFileName), XmlReadMode.ReadSchema); // Create a data binding source NMapDataTableBindingSource source = new NMapDataTableBindingSource(dataSet.Tables["Sales"]); // Create a data binding context NMapDataBindingContext context = new NMapDataBindingContext(); context.AddColumnMatching("NAME", "Country"); context.ColumnsToImport.Add("Sales"); // Perform the data binding countries.DataBind(source, context); // Add a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("Sales", Color.White, Color.DarkGreen, 8); fillRule.DataGrouping = dataGrouping; countries.FillRule = fillRule; mapImporter.Import(document, document.Bounds); // Generate the legend NMapLegendRange mapLegend = (NMapLegendRange)mapImporter.GetLegend(fillRule); mapLegend.Title = "Sales"; mapLegend.RangeFormatString = "{0:N0} - {1:N0} million dollars"; mapLegend.LastFormatString = "{0:N0} million dollars and more"; NMapLegendRenderPage.MapLegend = mapLegend; document.SizeToContent(); }
public void InitDocument(NDrawingDocument document, NDataGrouping dataGrouping) { // Configure the drawing document document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); // Add a style sheet NStyleSheet styleSheet = new NStyleSheet(WhiteTextStyleSheetName); NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone(); textStyle.FillStyle = new NColorFillStyle(KnownArgbColorValue.White); NStyle.SetTextStyle(styleSheet, textStyle); document.StyleSheets.AddChild(styleSheet); // Create a map importer NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add a shapefile NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; mapImporter.AddLayer(countries); // Read the map data mapImporter.Read(); // Create a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("POP_1994", Color.White, Color.Black, 12); fillRule.DataGrouping = dataGrouping; countries.FillRule = fillRule; // Associate a shape created listener and import the map data mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); mapImporter.Import(document, document.Bounds); // Generate a legend NMapLegendRange mapLegend = (NMapLegendRange)mapImporter.GetLegend(fillRule); mapLegend.Title = "Population (thousands people)"; mapLegend.RangeFormatString = "{0:#,###,##0,} - {1:#,###,##0,}"; mapLegend.LastFormatString = "more than {0:#,###,##0,}"; NMapLegendRenderPage.MapLegend = mapLegend; document.SizeToContent(); }
private List <NCityInfo> InitDocument(NDrawingDocument document) { document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); CreateStyleSheets(document); CreateStarPointShape(document); NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add the countries shape file NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; countries.MaxTextShowZoomFactor = 0.99f; mapImporter.AddLayer(countries); // Add the cities shape file NEsriShapefile cities = new NEsriShapefile(HttpContext.Current.Server.MapPath(CitiesShapefileName)); cities.NameColumn = "NAME"; cities.TextColumn = "NAME"; cities.MinShowZoomFactor = 1.0f; cities.PointSizeColumn = "POPULATION"; cities.MinPointShapeSize = new NSizeF(10, 10); cities.MaxPointShapeSize = new NSizeF(40, 40); mapImporter.AddLayer(cities); // Read the map data mapImporter.Read(); // Set a fill rule for the countries countries.FillRule = new NMapFillRuleValue("ISO_NUM", MapColors); // Add a shape created listener mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); // Import the map mapImporter.Import(document, document.Bounds); // Size the document to content document.SizeToContent(); return(((NCustomShapeCreatedListener)mapImporter.ShapeCreatedListener).Cities); }
private void InitDocument() { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 10000, 10000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); CreateStyleSheets(); CreateStarPointShape(); m_MapImporter = new NEsriMapImporter(); m_MapImporter.MapBounds = NMapBounds.World; // Create the COUNTRIES shapefile NEsriShapefile countries = new NEsriShapefile(Path.Combine(Application.StartupPath, CountriesFileName)); countries.NameColumn = "CNTRY_NAME"; countries.TextColumn = "CNTRY_NAME"; countries.MaxTextShowZoomFactor = 0.99f; countries.FillRule = new NMapFillRuleValue("COLOR_MAP", Colors); m_MapImporter.AddLayer(countries); // Create the CITIES shapefile NEsriShapefile cities = new NEsriShapefile(Path.Combine(Application.StartupPath, CitiesFileName)); cities.NameColumn = "NAME"; cities.TextColumn = "NAME"; cities.MinShowZoomFactor = 1.0f; cities.PointSizeColumn = "POPULATION"; cities.MinPointShapeSize = new NSizeF(10, 10); cities.MaxPointShapeSize = new NSizeF(40, 40); m_MapImporter.AddLayer(cities); // Read the map data m_MapImporter.Read(); // Import the map data to the drawing document m_MapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); m_MapImporter.Import(document, document.Bounds); }
protected override void InitDiagram() { base.InitDiagram(); // Configure the document NDrawing drawing = m_DrawingDocument.Content; drawing.ScreenVisibility.ShowGrid = false; // Add styles AddStyles(m_DrawingDocument); // Configure the active page NPage page = drawing.ActivePage; page.Bounds = new NRectangle(0, 0, 10000, 10000); page.ZoomMode = ENZoomMode.Fit; page.BackgroundFill = new NColorFill(NColor.LightBlue); // Create a map importer NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add an ESRI shapefile NEsriShapefile countries = new NEsriShapefile(Nevron.Nov.Diagram.NResources.RBIN_countries_zip); countries.NameColumn = "name_long"; countries.TextColumn = "name_long"; countries.MinTextZoomPercent = 50; countries.FillRule = new NMapFillRuleValue("mapcolor8", Colors); mapImporter.AddShapefile(countries); // Read the map data mapImporter.Read(); // Import the map to the drawing document mapImporter.Import(m_DrawingDocument, page.Bounds); // Size page to content page.SizeToContent(); }
protected override void InitDiagram() { base.InitDiagram(); // Configure the document NDrawing drawing = m_DrawingDocument.Content; drawing.ScreenVisibility.ShowGrid = false; // Add styles AddStyles(m_DrawingDocument); // Configure the active page NPage page = drawing.ActivePage; page.ZoomMode = ENZoomMode.Fit; page.BackgroundFill = new NColorFill(NColor.LightBlue); // Create a map importer m_MapImporter = new NEsriMapImporter(); m_MapImporter.MapBounds = NMapBounds.World; // Add a shapefile NEsriShapefile countries = new NEsriShapefile(Nevron.Nov.Diagram.NResources.RBIN_countries_zip); countries.NameColumn = "name_long"; countries.TextColumn = "name_long"; countries.MinTextZoomPercent = 50; countries.FillRule = new NMapFillRuleRange("pop_est", NColor.White, new NColor(0, 80, 0), 12); m_MapImporter.AddShapefile(countries); // Set the shape created listener m_MapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); // Read the map data m_MapImporter.Read(); // Import the map to the drawing document ImportMap(); }
protected override void InitDiagram() { base.InitDiagram(); // Configure the document NDrawing drawing = m_DrawingDocument.Content; drawing.ScreenVisibility.ShowGrid = false; // Add styles AddStyles(m_DrawingDocument); // Configure the active page NPage page = drawing.ActivePage; page.BackgroundFill = new NColorFill(NColor.LightBlue); page.Bounds = new NRectangle(0, 0, 10000, 10000); page.ZoomMode = ENZoomMode.Fit; // Create a map importer m_MapImporter = new NEsriMapImporter(); m_MapImporter.MapBounds = NMapBounds.World; m_MapImporter.MeridianSettings.RenderMode = ENArcRenderMode.BelowObjects; m_MapImporter.ParallelSettings.RenderMode = ENArcRenderMode.BelowObjects; m_MapImporter.Projection = m_Projections[DefaultProjectionIndex]; // Add an ESRI shapefile NEsriShapefile countries = new NEsriShapefile(Nevron.Nov.Diagram.NResources.RBIN_countries_zip); countries.NameColumn = "name_long"; countries.FillRule = new NMapFillRuleValue("mapcolor8", Colors); m_MapImporter.AddShapefile(countries); // Read the map data m_MapImporter.Read(); ImportMap(); }
private void InitDocument() { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 10000, 10000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); CreateStyleSheets(); m_MapImporter = new NEsriMapImporter(); m_MapImporter.MapBounds = NMapBounds.World; NEsriShapefile countries = new NEsriShapefile(Path.Combine(Application.StartupPath, COUNTRIES)); countries.NameColumn = "CNTRY_NAME"; m_MapImporter.AddLayer(countries); m_MapImporter.Read(); m_MapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); m_MapImporter.Parallels.ArcRenderMode = ArcRenderMode.Normal; m_MapImporter.Meridians.ArcRenderMode = ArcRenderMode.Normal; }
private void LoadMap(string fileName, string nameColumn, string textColumn, string toolTipColumn, float mapWidth, float mapHeight) { document.Layers.RemoveAllChildren(); document.Width = mapWidth; document.Height = mapHeight; NEsriMapImporter mapImporter = new NEsriMapImporter(); // Create the shapefile NEsriShapefile shapefile = new NEsriShapefile(Path.Combine(Application.StartupPath, fileName)); shapefile.NameColumn = nameColumn; shapefile.TextColumn = textColumn; mapImporter.AddLayer(shapefile); // Import the map mapImporter.Read(); if (String.IsNullOrEmpty(toolTipColumn) == false) { mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(toolTipColumn); } mapImporter.Import(document, document.Bounds); }
private void InitDocument() { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 10000, 10000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); m_MapImporter = new NEsriMapImporter(); m_MapImporter.MapBounds = NMapBounds.World; // Configure and add a shapefile NEsriShapefile countries = new NEsriShapefile(Path.Combine(Application.StartupPath, COUNTRIES)); countries.NameColumn = "CNTRY_NAME"; countries.TextColumn = "CNTRY_NAME"; m_MapImporter.AddLayer(countries); // Read the map data m_MapImporter.Read(); // Create a data binding source NMapOleDbDataBindingSource source = new NMapOleDbDataBindingSource(string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}\..\..\Resources\Maps\Sales.mdb", Application.StartupPath)); source.SelectQuery = "SELECT * FROM Sales"; // Create a data binding context NMapDataBindingContext context = new NMapDataBindingContext(); context.AddColumnMatching("CNTRY_NAME", "Country"); context.ColumnsToImport.Add("Sales"); // Perform the data binding countries.DataBind(source, context); // Create and apply a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("Sales", Color.White, Color.DarkGreen, 8); fillRule.DataGrouping = m_DataGrouping; countries.FillRule = fillRule; m_MapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); m_MapImporter.ShapeImporter.ImportInMultipleLayers = true; m_MapImporter.Import(document, document.Bounds); // Generate the legend NMapLegendRange mapLegend = (NMapLegendRange)m_MapImporter.GetLegend(fillRule); mapLegend.Title = "Sales"; mapLegend.RangeFormatString = "{0:N0} - {1:N0} million dollars"; mapLegend.LastFormatString = "{0:N0} million dollars and more"; if (pMapLegend == null) { pMapLegend = new Panel(); pMapLegend.Location = new Point(btnRecreateMap.Left, btnRecreateMap.Bottom + 10); pMapLegend.Width = btnRecreateMap.Width; pMapLegend.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; this.Controls.Add(pMapLegend); } mapLegend.Create(pMapLegend); // Size document to content document.SizeToContent(new NSizeF(0, 0), new Nevron.Diagram.NMargins(0)); }
private void InitDocument() { document.Layers.RemoveAllChildren(); // Configure the drawing document document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 10000, 10000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); // Add a style sheet NStyleSheet styleSheet = new NStyleSheet(WhiteTextStyleSheetName); NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone(); textStyle.FillStyle = new NColorFillStyle(KnownArgbColorValue.White); NStyle.SetTextStyle(styleSheet, textStyle); document.StyleSheets.AddChild(styleSheet); // Create a map importer m_MapImporter = new NEsriMapImporter(); m_MapImporter.MapBounds = NMapBounds.World; // Add a shapefile NEsriShapefile countries = new NEsriShapefile(Path.Combine(Application.StartupPath, Countries)); countries.NameColumn = "CNTRY_NAME"; countries.TextColumn = "CNTRY_NAME"; m_MapImporter.AddLayer(countries); // Read the map data m_MapImporter.Read(); // Create a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("POP_CNTRY", Color.White, Color.Black, 12); fillRule.DataGrouping = m_DataGrouping; countries.FillRule = fillRule; // Associate a shape created listener and import the map data m_MapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); m_MapImporter.Import(document, document.Bounds); // Generate a legend NMapLegendRange mapLegend = (NMapLegendRange)m_MapImporter.GetLegend(fillRule); mapLegend.Title = "Population"; mapLegend.RangeFormatString = "{0:N0} - {1:N0} people"; mapLegend.LastFormatString = "{0:N0} people and more"; if (pMapLegend == null) { pMapLegend = new Panel(); pMapLegend.Location = new Point(btnRecreateMap.Left, btnRecreateMap.Bottom + 10); pMapLegend.Width = btnRecreateMap.Width; pMapLegend.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; this.Controls.Add(pMapLegend); } mapLegend.Create(pMapLegend); }