/// <summary> /// Default constructor. /// </summary> public NMapProjectionsExample() { m_Projections = new NMapProjection[] { new NAitoffProjection(), new NBonneProjection(), new NCylindricalEqualAreaProjection(ENCylindricalEqualAreaProjectionType.Lambert), new NCylindricalEqualAreaProjection(ENCylindricalEqualAreaProjectionType.Behrmann), new NCylindricalEqualAreaProjection(ENCylindricalEqualAreaProjectionType.TristanEdwards), new NCylindricalEqualAreaProjection(ENCylindricalEqualAreaProjectionType.Peters), new NCylindricalEqualAreaProjection(ENCylindricalEqualAreaProjectionType.Gall), new NCylindricalEqualAreaProjection(ENCylindricalEqualAreaProjectionType.Balthasart), new NEckertIVProjection(), new NEckertVIProjection(), new NEquirectangularProjection(), new NHammerProjection(), new NKavrayskiyVIIProjection(), new NMercatorProjection(), new NMillerCylindricalProjection(), new NMollweideProjection(), new NOrthographicProjection(), new NRobinsonProjection(), new NStereographicProjection(), new NVanDerGrintenProjection(), new NWagnerVIProjection(), new NWinkelTripelProjection(), }; }
private void OnProjectionComboSelectedIndexChanged(NValueChangeEventArgs arg) { NComboBox projectionCombo = (NComboBox)arg.TargetNode; NMapProjection projection = (NMapProjection)projectionCombo.SelectedItem.Tag; m_MapImporter.Projection = projection; // Reimport the map applying the newly selected projection if (m_MapImporter.Projection is NOrthographicProjection) { GetOwnerPairBox(m_CenterParalelNumericUpDown).Visibility = ENVisibility.Visible; GetOwnerPairBox(m_CenterMeridianNumericUpDown).Visibility = ENVisibility.Visible; NOrthographicProjection ortographicProjection = (NOrthographicProjection)m_MapImporter.Projection; ortographicProjection.CenterPoint = new NPoint(m_CenterMeridianNumericUpDown.Value, m_CenterParalelNumericUpDown.Value); } else if (m_MapImporter.Projection is NBonneProjection) { GetOwnerPairBox(m_CenterParalelNumericUpDown).Visibility = ENVisibility.Visible; GetOwnerPairBox(m_CenterMeridianNumericUpDown).Visibility = ENVisibility.Hidden; ((NBonneProjection)m_MapImporter.Projection).StandardParallel = m_CenterParalelNumericUpDown.Value; } else { GetOwnerPairBox(m_CenterParalelNumericUpDown).Visibility = ENVisibility.Hidden; GetOwnerPairBox(m_CenterMeridianNumericUpDown).Visibility = ENVisibility.Hidden; } ImportMap(); }
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(); }