void TerrainDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; RowFormWidget::Prepare(parent, rc); const MapSettings &settings_map = CommonInterface::GetMapSettings(); const TerrainRendererSettings &terrain = settings_map.terrain; AddBoolean(_("Terrain display"), _("Draw a digital elevation terrain on the map."), terrain.enable); GetDataField(EnableTerrain).SetListener(this); AddBoolean(_("Topography display"), _("Draw topographical features (roads, rivers, lakes etc.) on the map."), settings_map.topography_enabled); static constexpr StaticEnumChoice terrain_ramp_list[] = { { 0, N_("Low lands"), }, { 1, N_("Mountainous"), }, { 2, N_("Imhof 7"), }, { 3, N_("Imhof 4"), }, { 4, N_("Imhof 12"), }, { 5, N_("Imhof Atlas"), }, { 6, N_("ICAO"), }, { 7, N_("Grey"), }, { 0 } }; AddEnum(_("Terrain colors"), _("Defines the color ramp used in terrain rendering."), terrain_ramp_list, terrain.ramp); GetDataField(TerrainColors).SetListener(this); static constexpr StaticEnumChoice slope_shading_list[] = { { (unsigned)SlopeShading::OFF, N_("Off"), }, { (unsigned)SlopeShading::FIXED, N_("Fixed"), }, { (unsigned)SlopeShading::SUN, N_("Sun"), }, { (unsigned)SlopeShading::WIND, N_("Wind"), }, { 0 } }; AddEnum(_("Slope shading"), _("The terrain can be shaded among slopes to indicate either wind direction, sun position or a fixed shading from north-east."), slope_shading_list, (unsigned)terrain.slope_shading); GetDataField(TerrainSlopeShading).SetListener(this); SetExpertRow(TerrainSlopeShading); AddInteger(_("Terrain contrast"), _("Defines the amount of Phong shading in the terrain rendering. Use large values to emphasise terrain slope, smaller values if flying in steep mountains."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.contrast)); GetDataField(TerrainContrast).SetListener(this); SetExpertRow(TerrainContrast); AddInteger(_("Terrain brightness"), _("Defines the brightness (whiteness) of the terrain rendering. This controls the average illumination of the terrain."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.brightness)); GetDataField(TerrainBrightness).SetListener(this); SetExpertRow(TerrainBrightness); if (::terrain != NULL) { WindowStyle style; style.Border(); AddRemaining(new WndOwnerDrawFrame(*(ContainerWindow *)GetWindow(), {0, 0, 100, 100}, style, ::OnPreviewPaint)); } terrain_settings = terrain; ShowTerrainControls(); }
void TerrainDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; RowFormWidget::Prepare(parent, rc); const MapSettings &settings_map = CommonInterface::GetMapSettings(); const TerrainRendererSettings &terrain = settings_map.terrain; AddBoolean(_("Terrain display"), _("Draw a digital elevation terrain on the map."), terrain.enable); GetDataField(EnableTerrain).SetListener(this); AddBoolean(_("Topography display"), _("Draw topographical features (roads, rivers, lakes etc.) on the map."), settings_map.topography_enabled); static constexpr StaticEnumChoice terrain_ramp_list[] = { { 0, N_("Low lands"), }, { 1, N_("Mountainous"), }, { 2, N_("Imhof 7"), }, { 3, N_("Imhof 4"), }, { 4, N_("Imhof 12"), }, { 5, N_("Imhof Atlas"), }, { 6, N_("ICAO"), }, { 9, N_("Vibrant"), }, { 7, N_("Grey"), }, { 8, N_("White"), }, {10, N_("Sandstone"), }, {11, N_("Pastel"), }, {12, N_("Italian Avioportolano VFR Chart"), }, {13, N_("German DFS VFR Chart"), }, {14, N_("French SIA VFR Chart"), }, { 0 } }; AddEnum(_("Terrain colors"), _("Defines the color ramp used in terrain rendering."), terrain_ramp_list, terrain.ramp); GetDataField(TerrainColors).SetListener(this); static constexpr StaticEnumChoice slope_shading_list[] = { { (unsigned)SlopeShading::OFF, N_("Off"), }, { (unsigned)SlopeShading::FIXED, N_("Fixed"), }, { (unsigned)SlopeShading::SUN, N_("Sun"), }, { (unsigned)SlopeShading::WIND, N_("Wind"), }, { 0 } }; AddEnum(_("Slope shading"), _("The terrain can be shaded among slopes to indicate either wind direction, sun position or a fixed shading from North-West."), slope_shading_list, (unsigned)terrain.slope_shading); GetDataField(TerrainSlopeShading).SetListener(this); SetExpertRow(TerrainSlopeShading); AddInteger(_("Terrain contrast"), _("Defines the amount of Phong shading in the terrain rendering. Use large values to emphasise terrain slope, smaller values if flying in steep mountains."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.contrast)); GetDataField(TerrainContrast).SetListener(this); SetExpertRow(TerrainContrast); AddInteger(_("Terrain brightness"), _("Defines the brightness (whiteness) of the terrain rendering. This controls the average illumination of the terrain."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.brightness)); GetDataField(TerrainBrightness).SetListener(this); SetExpertRow(TerrainBrightness); // JMW using enum here instead of bool so can provide more contour rendering // options later static constexpr StaticEnumChoice contours_list[] = { { (unsigned)Contours::OFF, N_("Off"), }, { (unsigned)Contours::ON, N_("On"), }, { 0 } }; AddEnum(_("Contours"), _("If enabled, draws contour lines on the terrain."), contours_list, (unsigned)terrain.contours); GetDataField(TerrainContours).SetListener(this); SetExpertRow(TerrainContours); if (::terrain != nullptr) { WindowStyle style; style.Border(); TerrainPreviewWindow *preview = new TerrainPreviewWindow(*::terrain); preview->Create((ContainerWindow &)GetWindow(), {0, 0, 100, 100}, style); AddRemaining(preview); } terrain_settings = terrain; ShowTerrainControls(); UpdateTerrainPreview(); }