[mapguide-commits] r6221 - in trunk/Tools/Maestro:
OSGeo.MapGuide.MaestroAPI/Mapping SDK/SamplesWeb/SamplesWeb
SDK/SamplesWeb/SamplesWeb/Tasks
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Nov 11 12:21:14 EST 2011
Author: jng
Date: 2011-11-11 09:21:14 -0800 (Fri, 11 Nov 2011)
New Revision: 6221
Modified:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx.cs
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs
Log:
This submission includes the following changes:
- Fetch and assign identity properties for newly created RuntimeMapLayer objects
- Fix draw order calculations when RuntimeMapLayer objects are added
- Fix the AddTracksLayer sample from the SDK web sample (the layer being created had a composite style by default which canceled out the line style we were trying to create)
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2011-11-11 14:12:28 UTC (rev 6220)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs 2011-11-11 17:21:14 UTC (rev 6221)
@@ -151,6 +151,11 @@
/// </summary>
public const double Z_ORDER_INCREMENT = 100.0;
+ /// <summary>
+ /// The draw order of the topmost layer
+ /// </summary>
+ public const double Z_ORDER_TOP = 100.0;
+
internal RuntimeMap(IServerConnection conn)
{
_disableChangeTracking = true;
@@ -272,7 +277,7 @@
foreach (var layer in mdf.MapLayer)
{
var rtl = new RuntimeMapLayer(this, layer, GetLayerDefinition(layer.ResourceId));
- rtl.DisplayOrder = (++dispIndex) * 1000;
+ rtl.DisplayOrder = (++dispIndex) * Z_ORDER_INCREMENT;
AddLayerInternal(rtl);
}
@@ -295,7 +300,7 @@
{
var rtl = new RuntimeMapLayer(this, layer, GetLayerDefinition(layer.ResourceId)) { Visible = true };
rtl.Type = RuntimeMapLayer.kBaseMap;
- rtl.DisplayOrder = (++dispIndex) * 1000;
+ rtl.DisplayOrder = (++dispIndex) * Z_ORDER_INCREMENT;
AddLayerInternal(rtl);
}
}
@@ -986,6 +991,22 @@
}
/// <summary>
+ /// Adds the layer.
+ /// </summary>
+ /// <param name="layer">The layer.</param>
+ internal void AddLayerInternal(RuntimeMapLayer layer)
+ {
+ RuntimeMapLayer prevLayer = (_layers.Count == 0 ? null : _layers[_layers.Count - 1]);
+ double zOrder = prevLayer == null ? Z_ORDER_TOP : prevLayer.DisplayOrder + Z_ORDER_INCREMENT;
+ layer.DisplayOrder = zOrder;
+
+ _layers.Add(layer);
+ _layerIdMap[layer.ObjectId] = layer;
+
+ OnLayerAdded(layer);
+ }
+
+ /// <summary>
/// Inserts the specified layer at the specified index. Does nothing
/// if the layer instance is already in the map.
/// </summary>
@@ -1000,6 +1021,40 @@
}
/// <summary>
+ /// Adds the layer
+ /// </summary>
+ /// <param name="value"></param>
+ /// <param name="index"></param>
+ internal void AddLayerInternal(RuntimeMapLayer value, int index)
+ {
+ //calculate zorder for the new layer
+ double zOrderLow, zOrderHigh;
+ RuntimeMapLayer layer;
+ if(index == 0)
+ {
+ zOrderLow = 0;
+ layer = _layers.Count > 0 ? _layers[index] : null;
+ if (layer != null)
+ zOrderHigh = layer.DisplayOrder;
+ else
+ zOrderHigh = 2.0 * Z_ORDER_INCREMENT;
+ }
+ else
+ {
+ layer = _layers[index - 1];
+ zOrderLow = layer.DisplayOrder;
+ layer = _layers.Count > index ? _layers[index] : null;
+ zOrderHigh = layer != null ? layer.DisplayOrder : zOrderLow + 2.0 * Z_ORDER_INCREMENT;
+ }
+ value.DisplayOrder = (zOrderLow + (zOrderHigh - zOrderLow) / 2.0);
+
+ _layers.Insert(index, value);
+ _layerIdMap[value.ObjectId] = value;
+
+ OnLayerAdded(value);
+ }
+
+ /// <summary>
/// Sets the layer to the specified index
/// </summary>
/// <param name="index">The index.</param>
@@ -1091,31 +1146,6 @@
}
/// <summary>
- /// Adds the layer.
- /// </summary>
- /// <param name="layer">The layer.</param>
- internal void AddLayerInternal(RuntimeMapLayer layer)
- {
- _layers.Add(layer);
- _layerIdMap[layer.ObjectId] = layer;
-
- OnLayerAdded(layer);
- }
-
- /// <summary>
- /// Adss the layer
- /// </summary>
- /// <param name="layer"></param>
- /// <param name="index"></param>
- internal void AddLayerInternal(RuntimeMapLayer layer, int index)
- {
- _layers.Insert(index, layer);
- _layerIdMap[layer.ObjectId] = layer;
-
- OnLayerAdded(layer);
- }
-
- /// <summary>
/// Creates the group and adds it to the map
/// </summary>
/// <param name="name">The name.</param>
@@ -1386,6 +1416,8 @@
internal void OnLayerAdded(RuntimeMapLayer layer)
{
+ //Fix the draw order of this layer that was added
+
//???
TrackChange(layer.ObjectId, true, Change.ChangeType.added, string.Empty);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs 2011-11-11 14:12:28 UTC (rev 6220)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapLayer.cs 2011-11-11 17:21:14 UTC (rev 6221)
@@ -24,6 +24,8 @@
using OSGeo.MapGuide.ObjectModels.LayerDefinition;
using OSGeo.MapGuide.MaestroAPI.Serialization;
using OSGeo.MapGuide.MaestroAPI.Resource;
+using OSGeo.MapGuide.ObjectModels.FeatureSource;
+using OSGeo.MapGuide.MaestroAPI.Feature;
namespace OSGeo.MapGuide.MaestroAPI.Mapping
{
@@ -91,6 +93,7 @@
this.GeometryPropertyName = vl.Geometry;
this.FeatureSourceID = vl.ResourceId;
this.Filter = vl.Filter;
+ InitIdentityProperties(vl);
}
else if (ldf.SubLayer.LayerType == LayerType.Raster)
{
@@ -186,7 +189,7 @@
}
this.HasTooltips = !string.IsNullOrEmpty(vld.ToolTip);
//get identity property information
-
+ InitIdentityProperties(vld);
}
break;
}
@@ -194,6 +197,24 @@
_disableChangeTracking = false;
}
+ private void InitIdentityProperties(IVectorLayerDefinition vl)
+ {
+ var fs = (IFeatureSource)this.Parent.ResourceService.GetResource(vl.ResourceId);
+ var cls = fs.GetClass(vl.FeatureName);
+
+ var idProps = cls.IdentityProperties;
+ var propInfo = new PropertyInfo[idProps.Count];
+
+ int i = 0;
+ foreach (var prop in idProps)
+ {
+ propInfo[i] = new PropertyInfo(prop.Name, ClrFdoTypeMap.GetClrType(prop.DataType));
+ i++;
+ }
+
+ this.IdentityProperties = propInfo;
+ }
+
private bool _visible;
/// <summary>
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj 2011-11-11 14:12:28 UTC (rev 6220)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj 2011-11-11 17:21:14 UTC (rev 6221)
@@ -180,12 +180,15 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
- <UseIIS>False</UseIIS>
+ <UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>49241</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost/mapguide/SamplesWeb/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx.cs 2011-11-11 14:12:28 UTC (rev 6220)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx.cs 2011-11-11 17:21:14 UTC (rev 6221)
@@ -102,7 +102,7 @@
"load",
"<script type=\"text/javascript\"> window.onload = function() { parent.parent.Refresh(); } </script>");
- lblMessage.Text = "Parcels layer added again";
+ lblMessage.Text = "Tracks layer added again";
}
rtMap = mpSvc.OpenMap(rtMapId);
@@ -133,6 +133,15 @@
//Get the first rule (a created one will only have one)
ILineRule rule = lstyle.GetRuleAt(0);
+ //What are we doing here? We're checking if this vector scale range is a
+ //IVectorScaleRange2 instance. If it is, it means this layer definition
+ //has a composite style attached, which takes precedence over point/area/line
+ //styles. We don't want this, so this removes the composite styles if they
+ //exist.
+ IVectorScaleRange2 vsr2 = vsr as IVectorScaleRange2;
+ if (vsr2 != null)
+ vsr2.CompositeStyle = null;
+
//There's only one stroke here, but iteration is the only
//way to go through
foreach (var stroke in rule.Strokes)
@@ -159,6 +168,7 @@
foreach (var layer in rtMap.Layers)
{
sb.Append("<li>Name: " + layer.Name + " (Selectable: " + layer.Selectable + ", Visible: " + layer.Visible + ")<br/>");
+ sb.Append("Label: " + layer.LegendLabel + "<br/>");
sb.Append("Group: " + layer.Group + "<br/>");
sb.Append("Draw Order: " + layer.DisplayOrder + "</li>");
}
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs 2011-11-11 14:12:28 UTC (rev 6220)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx.designer.cs 2011-11-11 17:21:14 UTC (rev 6221)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.4952
+// Runtime Version:2.0.50727.5448
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
More information about the mapguide-commits
mailing list