= MaestroAPI 4.x API comparison = Maestro 4.x has fundamental API changes from 2.x. This table outlines the main classes/interfaces in 2.x and their equivalents in 3.x (NOTE: This is not a comprehensive list, and the list has not been verified yet). The list also contains small code samples, that will late be pit in a separate section. Also see the '''[wiki:maestro/MaestroAPI/Maestro3ApiComparisons API 3.x Comparisons guide]''' for more info. {{{ #!html
v2.x | v4.x |
---|---|
IServerConnection con = new HttpServerConnection(host, sessionid, "en", true); | IServerConnection con = ConnectionProviderRegistry.CreateConnection("Maestro.Http", "Url=" + host + ";SessionId=" + sessionid + ";Locale=en;AllowUntestedVersion=true"); |
RuntimeMap map = con.GetRuntimeMap(mapid); |
IMappingService mapSvc = (IMappingService)con.GetService((int)ServiceType.Mapping); RuntimeMap map = mapSvc.OpenMap(mapid); |
new IMapDefinition() | ObjectFactory.CreateMapDefinition(con, map.Name); |
RuntimeMap map = new RuntimeMap(mdef); |
IMapDefinition mapDef = (IMapDefinition)con.ResourceService.GetResource(mapid); IMappingService mapSvc = (IMappingService)con.GetService((int)ServiceType.Mapping); RuntimeMap map = mapSvc.CreateMap(mapDef); |
IWebLayout layout = con.GetWebLayout(webLayout); | IWebLayout layout = (IWebLayout)con.ResourceService.GetResource(webLayout); |
MapDefinition layer = con.GetMapDefinition(mapDefId); | IMapDefinition layout = (IMapDefinition)con.ResourceService.GetResource(mapDefId); |
MapDefinition.BaseMapDefinition | IMapDefinition. |
for (int i = 0; i < mdef.BaseMap.FiniteDisplayScale.Count; i++) | foreach (double d in baseMap.FiniteDisplayScale) |
RuntimeMapLayer.Geometry | RuntimeMapLayer.GeometryPropertyName |
RuntimeMapLayer.Guid | RuntimeMapLayer.LayerDefinitionID |
LayerDefinition ldef = con.GetLayerDefinition(rl.ResourceId); | ILayerDefinition ldef = (ILayerDefinition)con.ResourceService.GetResource(rl.LayerDefinitionID); |
FeatureSource fs = con.GetFeatureSource(vldef.ResourceId); | IFeatureSource fs = ObjectFactory.CreateFeatureSource(con, vldef.ResourceId); |
RuntimeMap.LayerGroups | RuntimeMap.Groups |
map.Layers.RemoveAt(0); |
Add: using System.Linq; To make this work. |
con.SaveResourceAs(mdef, rtmDef); | con.ResourceService.SaveResourceAs(mdef, rtmDef); |
ldef.Item as VectorLayerDefinitionType | ldef.SubLayer; |
FeatureSetReader rd = layer.Query(filter, new string[] { layer.Geometry }) | IReader rd = map.CurrentConnection.FeatureService.QueryFeatureSource(layer.FeatureSourceID, layer.QualifiedClassName, new string[] { layer.GeometryPropertyName }) |
VectorScaleRangeType.Items |
IVectorScaleRange.PointStyle IVectorScaleRange.LineStyle IVectorScaleRange.AreaStyle |
VectorScaleRange.MinScaleSpecified/MaxScaleSpecified | IVectorScaleRange.MinScale.HasValue/.MaxScale.HasValue |
PointTypeStyleType | IPointVectorStyle |
LineTypeStyleType | ILineVectorStyle |
AreaTypeStyleType | IAreaVectorStyle |
LineRuleType | ILineRule |
PointRuleType.Item | IPointRule.PointSymbolization2D |
LineRuleType.Item | ILineRule.Stroke |
AreaRuleType.Item | IAreaRule.AreaSymbolization2D |
AreaTypeStyleType.AreaRule | IAreaVectorStyle.Rules |
GridLayerDefinitionType | IRasterLayerDefinition |
LayerDefinition.Item | ILayerDefinition |
LineTypeStyle.Items | ILineRule.Strokes |
ServerConnectionI.GetLegendImage | IMappingServicea.RenderMapLegend |
ServerConnectionI.DescribeFeatureSource | IServerConnection.FeatureService.DescribeFeatureSource |
FeatureSourceReader.Read() | IReader.ReadNext() |
FeatureSourceReader.Row.IsValueNull(column) | IReader.IsNull(column) |
foreach (FeatureSetColumn fsc in fsr.Columns) | for (int i=0; i<fsr.FieldCount; i++) |
FeatureSetReader.Columns.Length | IReader.FieldCount |
FeatureSetReader.Columns[i].Type | IReader.GetFieldType(i) |
FeatureSourceDescription.FeatureSourceSchema | FeatureSchema |
RuntimeMapLayer.NeedRefresh | RuntimeMapLayer.NeedsRefresh (to get) RuntimeMapLayer.ForceRefresh() (to set) |
RuntimeMapLayer.ResourceID | RuntimeMapLayer.LayerDefinitionID |
RuntimeMap.Extents | RuntimeMap.DataExtent |
ServerConnectionI.HasFolder |
con.ResourceService.ResourceExists(folderpath) Make sure that folderpath ends with '/' to indicate it's a folder |
ServerConnectionI.CreateFolder | con.ResourceService.SetResourceXmlData(folderpath, null) |
RuntimeMapLayer.ResourceId | RuntimeMapLayer.LayerDefinitionID |
map.FiniteScales |
IMapDefinition mdef =
(IMapDefinition)map.CurrentConnection.ResourceService.GetResource(map.MapDefinition); IBaseMapDefinition bm = mdef.BaseMap; bm.FiniteDisplayScale.ToArray(); |