예제 #1
0
        /// <summary>
        /// Returns a list of available Objects
        /// </summary>
        /// <returns></returns>
        public ObjectModels Get([FromUri] string objectTypeID = null)
        {
            string query = "EXEC rGetObjects";

            if (objectTypeID != null)
            {
                query = "EXEC rGetObjects @ObjectTypeID='" + objectTypeID + "'";
            }
            ObjectModels returnObjs = new ObjectModels();

            using (DataTable tblData = sqlObject.QuerySQL(query, ref sqlStatus))
            {
                if (tblData != null)
                {
                    foreach (DataRow item in tblData.Rows)
                    {
                        ObjectModel newObj = new ObjectModel();
                        newObj.DisplayName     = item["DisplayName"].ToString();
                        newObj.ObjectID        = item["ObjectID"].ToString();
                        newObj.ObjectTypeID    = item["ObjectTypeID"].ToString();
                        newObj.ObjectTypeText  = item["ObjectTypeText"].ToString();
                        newObj.ObjectTypeValue = item["ObjectTypeValue"].ToString();
                        returnObjs.RadiusObjects.Add(newObj);
                    }
                }
            }
            return(returnObjs);
        }
예제 #2
0
 /// <summary>
 /// Adjusts the boundingbox to equal proportions 
 /// </summary>
 /// <param name="bbox">The actual bounding box</param>
 /// <param name="scale">The scale to fit</param>
 /// <param name="size">The size to fit to</param>
 /// <returns>A bounding box with the correct ratio</returns>
 public ObjectModels.Common.IEnvelope AdjustBoundingBox(ObjectModels.Common.IEnvelope bbox, double scale, System.Drawing.Size size)
 {
     Check.NotNull(bbox, "bbox");
     var env = AdjustBoundingBox(new Envelope(bbox.MinX, bbox.MaxX, bbox.MinY, bbox.MaxY), scale, size);
     return OSGeo.MapGuide.ObjectModels.ObjectFactory.CreateEnvelope(env.MinX, env.MinY, env.MaxX, env.MaxY);
 }
예제 #3
0
 /// <summary>
 /// Calculates the scale of the map, given the bounding box and image size
 /// </summary>
 /// <param name="bbox">The map bounding box</param>
 /// <param name="size">The size of the image</param>
 /// <returns>The scale</returns>
 public double CalculateScale(ObjectModels.Common.IEnvelope bbox, System.Drawing.Size size)
 {
     Check.NotNull(bbox, "bbox");
     return CalculateScale(new Envelope(bbox.MinX, bbox.MaxX, bbox.MinY, bbox.MaxY), size);
 }
예제 #4
0
        public override Mapping.RuntimeMapLayer CreateMapLayer(Mapping.RuntimeMap parent, ObjectModels.LayerDefinition.ILayerDefinition ldf, bool suppressErrors)
        {
            var impl = parent as LocalRuntimeMap;
            if (impl == null)
                throw new ArgumentException("Instance is not a LocalRuntimeMap", "map"); //LOCALIZEME

            var ldfId = new MgResourceIdentifier(ldf.ResourceID);
            var layer = new MgdLayer(ldfId, GetResourceService());
            return new LocalRuntimeMapLayer(impl, layer, this, suppressErrors);
        }
예제 #5
0
        public override Mapping.RuntimeMapGroup CreateMapGroup(Mapping.RuntimeMap parent, ObjectModels.MapDefinition.IMapLayerGroup group)
        {
            var impl = parent as LocalRuntimeMap;
            if (impl == null)
                throw new ArgumentException("Instance is not a LocalRuntimeMap", "map"); //LOCALIZEME

            var rtGroup = new MgLayerGroup(group.Name);
            rtGroup.DisplayInLegend = group.ShowInLegend;
            MgdMap.SetGroupExpandInLegend(rtGroup, group.ExpandInLegend);
            rtGroup.LegendLabel = group.LegendLabel;
            rtGroup.Visible = group.Visible;

            var implMap = impl.GetWrappedInstance();
            var groups = implMap.GetLayerGroups();
            if (!string.IsNullOrEmpty(group.Group))
            {
                int idx = groups.IndexOf(group.Group);
                if (idx >= 0)
                {
                    var parentGrp = groups.GetItem(idx);
                    rtGroup.Group = parentGrp;
                }
            }

            return new LocalRuntimeMapGroup(impl, rtGroup);
        }
예제 #6
0
        public override Mapping.RuntimeMapGroup CreateMapGroup(Mapping.RuntimeMap parent, ObjectModels.MapDefinition.IBaseMapGroup group)
        {
            var impl = parent as LocalRuntimeMap;
            if (impl == null)
                throw new ArgumentException("Instance is not a LocalRuntimeMap", "map"); //LOCALIZEME

            var rtGroup = new MgLayerGroup(group.Name);
            rtGroup.DisplayInLegend = group.ShowInLegend;
            MgdMap.SetGroupExpandInLegend(rtGroup, group.ExpandInLegend);
            //MgdMap.SetLayerGroupType(rtGroup, MgLayerGroupType.BaseMap);
            rtGroup.LegendLabel = group.LegendLabel;
            rtGroup.Visible = group.Visible;

            return new LocalRuntimeMapGroup(impl, rtGroup);
        }
예제 #7
0
 public override Mapping.RuntimeMap CreateMap(string runtimeMapResourceId, ObjectModels.MapDefinition.IMapDefinition mdf, double metersPerUnit, bool suppressErrors)
 {
     var mdfId = new MgResourceIdentifier(mdf.ResourceID);
     var implMap = new MgdMap(mdfId);
     var map = new LocalRuntimeMap(this, implMap, suppressErrors);
     map.ResourceID = runtimeMapResourceId;
     map.ResetDirtyState();
     return map;
 }