[mapguide-commits] r7153 - in trunk/MgDev/Desktop: . MapViewer MapViewer/AppLayoutEngine MgAppLayout MgDesktop

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 24 23:01:38 PDT 2012


Author: jng
Date: 2012-10-24 23:01:38 -0700 (Wed, 24 Oct 2012)
New Revision: 7153

Modified:
   trunk/MgDev/Desktop/
   trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/AppLayout.cs
   trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/Shell.cs
   trunk/MgDev/Desktop/MapViewer/MgQueryComponent.cs
   trunk/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs
   trunk/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout
   trunk/MgDev/Desktop/MgDesktop/changelog.txt
Log:
mg-desktop: Merge r7152 to trunk


Property changes on: trunk/MgDev/Desktop
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/2.4/MgDev/Desktop:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006,7152
/sandbox/rfc94/Desktop:5099-5163

Modified: trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/AppLayout.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/AppLayout.cs	2012-10-25 04:21:08 UTC (rev 7152)
+++ trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/AppLayout.cs	2012-10-25 06:01:38 UTC (rev 7153)
@@ -379,6 +379,9 @@
         public string ComponentID { get; set; }
 
         [XmlElement]
+        public string Label { get; set; }
+
+        [XmlElement]
         public string ClassName { get; set; }
 
         [XmlElement]
@@ -418,5 +421,6 @@
         public const string ENUM = "enum:"; //NOXLATE
         public const string VIEWERID = "viewer:"; //NOXLATE
         public const string TASKPANEID = "taskpane:"; //NOXLATE
+        public const string STRINGARRAY = "stringarray:"; //NOXLATE
     }
 }

Modified: trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/Shell.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/Shell.cs	2012-10-25 04:21:08 UTC (rev 7152)
+++ trunk/MgDev/Desktop/MapViewer/AppLayoutEngine/Shell.cs	2012-10-25 06:01:38 UTC (rev 7153)
@@ -369,6 +369,9 @@
                                 throw new InvalidOperationException(string.Format(Strings.ErrorComponentAlreadyExists, compDef.ComponentID));
                             var comp = (MgComponent)Activator.CreateInstance(type);
                             _components[compDef.ComponentID] = comp;
+                            //Override default label if specified
+                            if (!string.IsNullOrEmpty(compDef.Label))
+                                comp.Label = compDef.Label;
                             break;
                         }
                     }
@@ -432,6 +435,12 @@
                             throw new InvalidOperationException(Strings.ErrorMalformedEnumString);
                         comp.SetPropertyValue(prop.Name, Enum.Parse(Type.GetType(tokens[1]), tokens[2]));
                     }
+                    else if (prop.Value.StartsWith(StringPrefixes.STRINGARRAY))
+                    {
+                        var csvList = prop.Value.Substring(StringPrefixes.STRINGARRAY.Length);
+                        var values = csvList.Split(',');
+                        comp.SetPropertyValue(prop.Name, values);
+                    }
                     else if (prop.Value.StartsWith(StringPrefixes.TASKPANEID)) //NOTE: only one taskpane instance, but we're checking this as a forward-looking measure
                     {
                         comp.SetPropertyValue(prop.Name, taskPane);

Modified: trunk/MgDev/Desktop/MapViewer/MgQueryComponent.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewer/MgQueryComponent.cs	2012-10-25 04:21:08 UTC (rev 7152)
+++ trunk/MgDev/Desktop/MapViewer/MgQueryComponent.cs	2012-10-25 06:01:38 UTC (rev 7153)
@@ -17,9 +17,22 @@
             this.Label = this.ToolTipText = Strings.TitleQuery;
         }
 
+        [Category("MapGuide Component Properties")] //NOXLATE
+        [Description("An optional list of layer names that will be displayed in the list of queryable layers. If left empty, all layers from the map will be displayed in the list of queryable layers")] //NOXLATE
+        [DefaultValue(MeasurementUnit.Meters)]
+        [MgComponentProperty]
+        public string[] LayerList
+        {
+            get;
+            set;
+        }
+
         protected override MgControlView CreateControlView()
         {
-            return new MgQueryControlImpl(this.Viewer);
+            if (this.LayerList == null || this.LayerList.Length == 0)
+                return new MgQueryControlImpl(this.Viewer);
+            else
+                return new MgQueryControlImpl(this.Viewer, this.LayerList);
         }
     }
 }

Modified: trunk/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs	2012-10-25 04:21:08 UTC (rev 7152)
+++ trunk/MgDev/Desktop/MapViewer/MgQueryControlImpl.cs	2012-10-25 06:01:38 UTC (rev 7153)
@@ -17,9 +17,19 @@
         private BindingList<MgDataPropertyDefinition> _properties;
         private BindingList<MgLayerBase> _layers;
 
-        public MgQueryControlImpl(IMapViewer viewer)
+        private string[] _restrictedLayerList;
+
+        public MgQueryControlImpl(IMapViewer viewer, string[] layerList)
         {
             InitializeComponent();
+            _restrictedLayerList = layerList;
+            InitBase(viewer);
+            LoadLayerList(viewer);
+            cmbLayer.SelectedIndex = 0;
+        }
+
+        private void InitBase(IMapViewer viewer)
+        {
             this.Title = Strings.TitleQuery;
             this.Disposed += new EventHandler(OnDisposed);
             _viewer = viewer;
@@ -33,14 +43,38 @@
             cmbProperty.DataSource = _properties;
 
             cmbOperator.SelectedIndex = 0;
-            
+        }
+
+        public MgQueryControlImpl(IMapViewer viewer)
+        {
+            InitializeComponent();
+            InitBase(viewer);
+            LoadLayerList(viewer);
+            cmbLayer.SelectedIndex = 0;
+        }
+
+        private void LoadLayerList(IMapViewer viewer)
+        {
             var map = viewer.GetMap();
             var layers = map.GetLayers();
-            for (var i = 0; i < layers.GetCount(); i++)
+            if (_restrictedLayerList != null && _restrictedLayerList.Length > 0)
             {
-                _layers.Add(layers.GetItem(i));
+                foreach (var name in _restrictedLayerList)
+                {
+                    if (layers.IndexOf(name) < 0)
+                        continue;
+
+                    var layer = layers.GetItem(name);
+                    _layers.Add(layer);
+                }
             }
-            cmbLayer.SelectedIndex = 0;
+            else
+            {
+                for (var i = 0; i < layers.GetCount(); i++)
+                {
+                    _layers.Add(layers.GetItem(i));
+                }
+            }
         }
 
         void OnDisposed(object sender, EventArgs e)
@@ -191,12 +225,7 @@
         private void lnkRefreshLayers_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
         {
             _layers.Clear();
-            var map = _viewer.GetMap();
-            var layers = map.GetLayers();
-            for (var i = 0; i < layers.GetCount(); i++)
-            {
-                _layers.Add(layers.GetItem(i));
-            }
+            LoadLayerList(_viewer);
             if (cmbLayer.SelectedIndex != 0)
                 cmbLayer.SelectedIndex = 0;
             else

Modified: trunk/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout
===================================================================
--- trunk/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout	2012-10-25 04:21:08 UTC (rev 7152)
+++ trunk/MgDev/Desktop/MgAppLayout/Sheboygan.AppLayout	2012-10-25 06:01:38 UTC (rev 7153)
@@ -185,6 +185,10 @@
             <ShowLabel>false</ShowLabel>
           </ItemBase>
           <ItemBase xsi:type="CommandItem">
+            <ComponentID>QueryRestricted</ComponentID>
+            <ShowLabel>false</ShowLabel>
+          </ItemBase>
+          <ItemBase xsi:type="CommandItem">
             <ComponentID>Theme</ComponentID>
             <ShowLabel>false</ShowLabel>
           </ItemBase>
@@ -255,6 +259,10 @@
             <ShowLabel>false</ShowLabel>
           </ItemBase>
           <ItemBase xsi:type="CommandItem">
+            <ComponentID>QueryRestricted</ComponentID>
+            <ShowLabel>false</ShowLabel>
+          </ItemBase>
+          <ItemBase xsi:type="CommandItem">
             <ComponentID>Theme</ComponentID>
             <ShowLabel>false</ShowLabel>
           </ItemBase>
@@ -289,6 +297,10 @@
           <ShowLabel>false</ShowLabel>
         </ItemBase>
         <ItemBase xsi:type="CommandItem">
+          <ComponentID>QueryRestricted</ComponentID>
+          <ShowLabel>false</ShowLabel>
+        </ItemBase>
+        <ItemBase xsi:type="CommandItem">
           <ComponentID>Theme</ComponentID>
           <ShowLabel>false</ShowLabel>
         </ItemBase>
@@ -412,6 +424,25 @@
       </Properties>
     </ComponentDefinition>
     <ComponentDefinition>
+      <ComponentID>QueryRestricted</ComponentID>
+      <Label>Query (restricted)</Label>
+      <ClassName>OSGeo.MapGuide.Viewer.MgQueryComponent</ClassName>
+      <Properties>
+        <NameValue>
+          <Name>Target</Name>
+          <Value>enum:OSGeo.MapGuide.Viewer.MgViewerTarget:TaskPane</Value>
+        </NameValue>
+        <NameValue>
+          <Name>TaskPane</Name>
+          <Value>taskpane:</Value>
+        </NameValue>
+        <NameValue>
+          <Name>LayerList</Name>
+          <Value>stringarray:Parcels,Roads</Value>
+        </NameValue>
+      </Properties>
+    </ComponentDefinition>
+    <ComponentDefinition>
       <ComponentID>Quit</ComponentID>
       <ClassName>OSGeo.MapGuide.Viewer.AppLayoutEngine.MgQuitComponent</ClassName>
     </ComponentDefinition>

Modified: trunk/MgDev/Desktop/MgDesktop/changelog.txt
===================================================================
--- trunk/MgDev/Desktop/MgDesktop/changelog.txt	2012-10-25 04:21:08 UTC (rev 7152)
+++ trunk/MgDev/Desktop/MgDesktop/changelog.txt	2012-10-25 06:01:38 UTC (rev 7153)
@@ -1,3 +1,13 @@
+Viewer Changelog:
+
+ - Query component now supports a LayerList property allowing the list of queryable layers in the UI to be restricted to what is in this list.
+ - AppLayout component definitions can have their labels overridden by specifying a <Label> element in the ComponentDefinition.
+ - AppLayout engine support for string array property values
+ - Fix issue when selecting objects from a layer with no property display mappings.
+
+2.4.0.7096 (Oct 9 2012)
+=======================
+
 API Changelog:
 
  - MgdPlatform::Terminate() did not call MgdFdoConnectionPool::Cleanup() leaving that to the static initializer to cleanup. This caused problems for the GDAL provider if connection pooling is enabled. The call has been put into MgdPlatform::Terminate() and connection pooling for the GDAL provider has been re-enabled in Platform.ini



More information about the mapguide-commits mailing list