[mapguide-commits] r6635 - in branches/maestro-4.0.x: Maestro Maestro.Editors/LayerDefinition/Raster OSGeo.MapGuide.MaestroAPI/ObjectModels

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed May 9 09:31:24 EDT 2012


Author: jng
Date: 2012-05-09 06:31:24 -0700 (Wed, 09 May 2012)
New Revision: 6635

Modified:
   branches/maestro-4.0.x/Maestro.Editors/LayerDefinition/Raster/RasterLayerAdvancedSectionCtrl.cs
   branches/maestro-4.0.x/Maestro/changelog.txt
   branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs
Log:
#1963: Fix raster layer advanced settings not saving. Note that default values are omitted from the final xml, which is still okay because MapGuide will still assume said defaults in the absence of these elements.

Modified: branches/maestro-4.0.x/Maestro/changelog.txt
===================================================================
--- branches/maestro-4.0.x/Maestro/changelog.txt	2012-05-09 13:21:18 UTC (rev 6634)
+++ branches/maestro-4.0.x/Maestro/changelog.txt	2012-05-09 13:31:24 UTC (rev 6635)
@@ -3,6 +3,7 @@
  - Uses new mg-desktop release (8 May 2012, .net 2.0, VC9)
  - New command to open sources by entering its resource id
  - New shortcut buttons to jump from Layer Definition to Feature/Drawing Source
+ - Fix: Raster layer advanced settings not saving.
  - Fix: Groups/Layer info in Map Definition editor not updating via up/down keypress
  - Fix: Row/Column mismatch in GetTile API (http implemenation)
  - Fix: AllowOverpost and DisplayAsText properties for basic point style not exposed in editor UI

Modified: branches/maestro-4.0.x/Maestro.Editors/LayerDefinition/Raster/RasterLayerAdvancedSectionCtrl.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/LayerDefinition/Raster/RasterLayerAdvancedSectionCtrl.cs	2012-05-09 13:21:18 UTC (rev 6634)
+++ branches/maestro-4.0.x/Maestro.Editors/LayerDefinition/Raster/RasterLayerAdvancedSectionCtrl.cs	2012-05-09 13:31:24 UTC (rev 6635)
@@ -122,38 +122,37 @@
             if (chkAdvanced.Checked)
             {
                 txtBrightnessFactor.Enabled = txtContrastFactor.Enabled = cmbTransparencyColor.Enabled = true;
-                try
-                {
-                    _init = true;
-                    //Restore values from UI fields
-                    txtBrightnessFactor_TextChanged(this, EventArgs.Empty);
-                    txtContrastFactor_TextChanged(this, EventArgs.Empty);
-                    cmbTransparencyColor_SelectedIndexChanged(this, EventArgs.Empty);
-                    //Check if attached
-                    EnableSurface.Checked = (_activeRange.SurfaceStyle != null);
-                    EnableHillshade.Checked = (_colorStyle.HillShade != null);
-                }
-                finally { _init = false; }
+                //Restore values from UI fields, can't call the actual event handler methods
+                //because _init = true so they do nothing
+                double d;
+                if (double.TryParse(txtBrightnessFactor.Text, out d))
+                    _colorStyle.BrightnessFactor = d;
+                else
+                    _colorStyle.BrightnessFactor = null;
+                if (double.TryParse(txtContrastFactor.Text, out d))
+                    _colorStyle.ContrastFactor = d;
+                else
+                    _colorStyle.ContrastFactor = null;
+                _colorStyle.TransparencyColor = Utility.SerializeHTMLColor(cmbTransparencyColor.CurrentColor, false);
+                //Check if attached
+                EnableSurface.Checked = (_activeRange.SurfaceStyle != null);
+                EnableHillshade.Checked = (_colorStyle.HillShade != null);
             }
             else
             {
-                try
-                {
-                    _init = true;
-                    _colorStyle.BrightnessFactor = null;
-                    _colorStyle.ContrastFactor = null;
-                    _colorStyle.TransparencyColor = null;
+                _colorStyle.BrightnessFactor = null;
+                _colorStyle.ContrastFactor = null;
+                _colorStyle.TransparencyColor = null;
 
-                    txtBrightnessFactor.Enabled = txtContrastFactor.Enabled = cmbTransparencyColor.Enabled = false;
+                txtBrightnessFactor.Enabled = txtContrastFactor.Enabled = cmbTransparencyColor.Enabled = false;
 
-                    //Detach
-                    EnableSurface.Checked = false;
-                    EnableHillshade.Checked = false;
-                    _colorStyle.HillShade = null;
-                    _activeRange.SurfaceStyle = null;
-                }
-                catch { _init = false; }
+                //Detach
+                EnableSurface.Checked = false;
+                EnableHillshade.Checked = false;
+                _colorStyle.HillShade = null;
+                _activeRange.SurfaceStyle = null;
             }
+            OnResourceChanged();
         }
 
         private void EnableHillshade_CheckedChanged(object sender, EventArgs e)

Modified: branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs
===================================================================
--- branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs	2012-05-09 13:21:18 UTC (rev 6634)
+++ branches/maestro-4.0.x/OSGeo.MapGuide.MaestroAPI/ObjectModels/GridLayerDefinitionImpl.cs	2012-05-09 13:31:24 UTC (rev 6635)
@@ -504,30 +504,15 @@
         }
 
         [XmlIgnore]
-        public bool BrightnessFactorSpecified { get; set; }
-
-        [XmlIgnore]
-        public bool ContrastFactorSpecified { get; set; }
-
-        [XmlIgnore]
         double? IGridColorStyle.BrightnessFactor
         {
             get
             {
-                if (this.BrightnessFactorSpecified)
-                    return this.BrightnessFactor;
-                else
-                    return null;
+                return this.BrightnessFactor;
             }
             set
             {
-                if (value.HasValue)
-                {
-                    this.BrightnessFactor = value.Value;
-                    this.BrightnessFactorSpecified = true;
-                }
-                else
-                    this.BrightnessFactorSpecified = false;
+                this.BrightnessFactor = value.HasValue ? value.Value : default(double);
             }
         }
 
@@ -536,20 +521,11 @@
         {
             get
             {
-                if (this.ContrastFactorSpecified)
-                    return this.ContrastFactor;
-                else
-                    return null;
+                return this.ContrastFactor;
             }
             set
             {
-                if (value.HasValue)
-                {
-                    this.ContrastFactor = value.Value;
-                    this.ContrastFactorSpecified = true;
-                }
-                else
-                    this.ContrastFactorSpecified = false;
+                this.ContrastFactor = value.HasValue ? value.Value : default(double);
             }
         }
 



More information about the mapguide-commits mailing list