• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MgResourceIdentifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MgResourceIdentifier的典型用法代码示例。如果您正苦于以下问题:C# MgResourceIdentifier类的具体用法?C# MgResourceIdentifier怎么用?C# MgResourceIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MgResourceIdentifier类属于命名空间,在下文中一共展示了MgResourceIdentifier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ClearSpatialFilter

    public bool ClearSpatialFilter()
    {
        bool result = true;
        MgUserInformation userInfo = new MgUserInformation(Request["SESSION"]);
        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfo);

        MgResourceIdentifier sdfResId = new MgResourceIdentifier("Session:" + Request["SESSION"] + "//Filter.FeatureSource");

        MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
        MgFeatureService featureService = siteConnection.CreateService(MgServiceType.FeatureService) as MgFeatureService;
        MgMap map = new MgMap();
        map.Open(resourceService, Request["MAPNAME"]);

        MgFeatureCommandCollection updateCommands = new MgFeatureCommandCollection();

        MgLayer layer = null;
        MgLayerCollection layers = map.GetLayers();
        if (layers.Contains("_QuerySpatialFilter"))
        {
            layer = (MgLayer)layers.GetItem("_QuerySpatialFilter");
            updateCommands.Add(new MgDeleteFeatures("Filter", "ID > 0"));
            featureService.UpdateFeatures(sdfResId, updateCommands, false);
            layers.Remove(layer);
            map.Save(resourceService);
        }

        return result;
    }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:29,代码来源:CreateGeometry.aspx.cs


示例2: Invoke

 public override void Invoke()
 {
     var provider = this.Viewer.GetProvider();
     var mdfId = new MgResourceIdentifier(this.MapDefinition);
     var map = provider.CreateMap(mdfId, mdfId.GetName());
     provider.LoadMap(map);
 }
开发者ID:kanbang,项目名称:Colt,代码行数:7,代码来源:MgLoadMapComponent.cs


示例3: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var fact = new MgdServiceFactory();
                MgFeatureService featSvc = (MgdFeatureService)fact.CreateService(MgServiceType.FeatureService);
                MgFeatureQueryOptions query = new MgFeatureQueryOptions();
                string[] propNames = txtProps.Text.Split(',');
                foreach (var p in propNames)
                {
                    if (string.IsNullOrEmpty(p))
                        continue;

                    query.AddFeatureProperty(p);
                }

                foreach (Pair p in lstComputed.Items)
                {
                    query.AddComputedProperty(p.Name, p.Expr);
                }

                if (!string.IsNullOrEmpty(txtFilter.Text.Trim()))
                    query.SetFilter(txtFilter.Text.Trim());

                MgResourceIdentifier fsId = new MgResourceIdentifier(txtFeatureSource.Text);

                MgFeatureReader reader = featSvc.SelectFeatures(fsId, txtClass.Text, query);
                new ReaderResponseDialog(reader).ShowDialog();
            }
            catch (MgException ex)
            {
                MessageBox.Show(ex.ToString(), "Error from MapGuide");
            }
        }
开发者ID:kanbang,项目名称:Colt,代码行数:34,代码来源:SelectFeaturesControl.cs


示例4: createMuniMarker

    //----------------------------------------------------------------------------------------
    // �� �ܣ� ��Mapguide���ص�����ת��ΪKML
    //
    // �� �ߣ�
    //
    //
    // �� �ڣ�2007.05.#
    //
    //-----------------------------------------------------------------------------------------
    public String createMuniMarker()
    {
        StringBuilder outString = new StringBuilder();
        MgGeometryFactory geoFactory = new MgGeometryFactory();
        outString.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        MgFeatureService featureService = (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
        MgResourceIdentifier resId = new MgResourceIdentifier("Library://MgTutorial/Data/WheatonMunicipalities.FeatureSource");
        MgFeatureReader featureReader = featureService.SelectFeatures(resId, "WheatonMunicipalities", null);

        outString.Append("<markers>");
        MgAgfReaderWriter geoReader = new MgAgfReaderWriter();
        while (featureReader.ReadNext())
        {
            String muniName = featureReader.GetString("MUNINAME");
            MgByteReader byteReader = featureReader.GetGeometry("Geometry");
            MgGeometry geo = geoReader.Read(byteReader);
            MgPoint pt = geo.GetCentroid();
            double x = pt.GetCoordinate().GetX();
            double y = pt.GetCoordinate().GetY();
            outString.Append("<marker lat=\"" + y + "\" lng=\"" + x + "\" info=\"" + muniName + "\" />");
        }
        featureReader.Close();
        outString.Append("</markers>");

        return outString.ToString();
    }
开发者ID:guchanghai,项目名称:Cut,代码行数:35,代码来源:UtilityClass.cs


示例5: Plot

        private MgByteReader Plot(MapGuideViewerInputModel input, bool useLayout, double? scale)
        {
            MgSiteConnection conn = CreateConnection(input);
            MgMap map = new MgMap(conn);
            map.Open(input.MapName);

            MgPoint center = map.ViewCenter;
            MgCoordinate coord = center.Coordinate;

            MgMappingService mappingService = (MgMappingService)conn.CreateService(MgServiceType.MappingService);

            MgDwfVersion dwfVersion = new MgDwfVersion("6.01", "1.2");
            MgPlotSpecification plotSpec = new MgPlotSpecification(8.5f, 11f, MgPageUnitsType.Inches, 0f, 0f, 0f, 0f);
            plotSpec.SetMargins(0.5f, 0.5f, 0.5f, 0.5f);

            MgLayout layout = null;
            if (useLayout)
            {
                MgResourceIdentifier layoutRes = new MgResourceIdentifier("Library://Samples/Sheboygan/Layouts/SheboyganMap.PrintLayout");
                layout = new MgLayout(layoutRes, "City of Sheboygan", MgPageUnitsType.Inches);
            }

            if (!scale.HasValue)
            {
                return mappingService.GeneratePlot(map, plotSpec, layout, dwfVersion);
            }
            else
            {
                MgCoordinate mapCenter = map.GetViewCenter().GetCoordinate();
                return mappingService.GeneratePlot(map, mapCenter, scale.Value, plotSpec, layout, dwfVersion);
            }
        }
开发者ID:alexasahis,项目名称:mapguide-mvc-sample,代码行数:32,代码来源:DwfPlotController.cs


示例6: GetAllFeatures

        public IEnumerable<RedlineObject> GetAllFeatures()
        {
            MgMapBase map = _viewer.GetMap();
            MgLayerCollection layers = map.GetLayers();
            MgLayerBase redlineLayer = layers.GetItem(_layer.SystemName);

            MgResourceIdentifier resId = new MgResourceIdentifier(redlineLayer.GetFeatureSourceId());
            MgFeatureReader reader = null;
            try
            {
                reader = _featSvc.SelectFeatures(resId, RedlineSchemaFactory.CLASS_NAME, null);

                //HACK: Another leaky abstraction. SHP will always choose FeatId, so once again
                //use the class definition to determine the identity property name
                MgClassDefinition cls = reader.GetClassDefinition();
                MgPropertyDefinitionCollection idProps = cls.GetIdentityProperties();
                MgPropertyDefinition keyProp = idProps.GetItem(0);
                string idName = keyProp.GetName();

                while (reader.ReadNext())
                {
                    int id = reader.GetInt32(idName);
                    string text = reader.IsNull(RedlineSchemaFactory.TEXT_NAME) ? string.Empty : reader.GetString(RedlineSchemaFactory.TEXT_NAME);

                    yield return new RedlineObject(id, text);
                }
            }
            finally
            {
                if (reader != null)
                    reader.Close();
            }
        }
开发者ID:kanbang,项目名称:Colt,代码行数:33,代码来源:RedlineEditor.cs


示例7: CreateBufferFeatureSource

        public void CreateBufferFeatureSource(MgFeatureService featureService, String wkt, MgResourceIdentifier bufferFeatureResId)
        {
            MgClassDefinition bufferClass = new MgClassDefinition();
            bufferClass.SetName("BufferClass");
            MgPropertyDefinitionCollection properties = bufferClass.GetProperties();

            MgDataPropertyDefinition idProperty = new MgDataPropertyDefinition("ID");
            idProperty.SetDataType(MgPropertyType.Int32);
            idProperty.SetReadOnly(true);
            idProperty.SetNullable(false);
            idProperty.SetAutoGeneration(true);
            properties.Add(idProperty);

            MgGeometricPropertyDefinition polygonProperty = new MgGeometricPropertyDefinition("BufferGeometry");
            polygonProperty.SetGeometryTypes(MgFeatureGeometricType.Surface);
            polygonProperty.SetHasElevation(false);
            polygonProperty.SetHasMeasure(false);
            polygonProperty.SetReadOnly(false);
            polygonProperty.SetSpatialContextAssociation("defaultSrs");
            properties.Add(polygonProperty);

            MgPropertyDefinitionCollection idProperties = bufferClass.GetIdentityProperties();
            idProperties.Add(idProperty);

            bufferClass.SetDefaultGeometryPropertyName("BufferGeometry");

            MgFeatureSchema bufferSchema = new MgFeatureSchema("BufferLayerSchema", "temporary schema to hold a buffer");
            bufferSchema.GetClasses().Add(bufferClass);

            MgCreateSdfParams sdfParams = new MgCreateSdfParams("defaultSrs", wkt, bufferSchema);

            featureService.CreateFeatureSource(bufferFeatureResId, sdfParams);
        }
开发者ID:kanbang,项目名称:Colt,代码行数:33,代码来源:BufferHelper.cs


示例8: Index

        // GET: Home
        public ActionResult Index()
        {
            MgUserInformation user = new MgUserInformation("Anonymous", "");
            MgSiteConnection conn = new MgSiteConnection();
            conn.Open(user);

            MgResourceService resSvc = (MgResourceService)conn.CreateService(MgServiceType.ResourceService);

            var vm = new HomeViewModel()
            {
                HasSampleResources = true,
                AjaxLayout = AJAX_LAYOUT,
                FlexLayout = FLEX_LAYOUT
            };

            MgResourceIdentifier mdfId = new MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
            MgResourceIdentifier sample1 = new MgResourceIdentifier(vm.AjaxLayout);
            MgResourceIdentifier sample2 = new MgResourceIdentifier(vm.FlexLayout);

            vm.HasSampleResources = resSvc.ResourceExists(mdfId) &&
                                    resSvc.ResourceExists(sample1) &&
                                    resSvc.ResourceExists(sample2);

            return View(vm);
        }
开发者ID:alexasahis,项目名称:mapguide-mvc-sample,代码行数:26,代码来源:HomeController.cs


示例9: btnCreateFile_Click

        private void btnCreateFile_Click(object sender, EventArgs e)
        {
            try
            {
                var fact = new MgdServiceFactory();
                var featureSvc = (MgdFeatureService)fact.CreateService(MgServiceType.FeatureService);
                var param = new MgFileFeatureSourceParams();
                param.CoordinateSystemWkt = txtCoordinateSystemWkt.Text;
                param.FileName = txtFileName.Text;

                var schemas = featureSvc.XmlToSchema(File.ReadAllText(txtSchemaXml.Text));
                param.FeatureSchema = schemas.GetItem(0);

                param.ProviderName = txtProvider.Text;
                param.SpatialContextDescription = "Created from MgFileFeatureSourceParams";
                param.SpatialContextName = txtCoordinateSystemName.Text;
                param.XYTolerance = double.Parse(txtXYTolerance.Text);
                param.ZTolerance = double.Parse(txtZTolerance.Text);

                var fsId = new MgResourceIdentifier(txtResourceId.Text);

                featureSvc.CreateFeatureSource(fsId, param);
                MessageBox.Show("Success");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
开发者ID:kanbang,项目名称:Colt,代码行数:29,代码来源:CreateFeatureSourceCtrl.cs


示例10: TestEnd

        public void TestEnd()
        {
            try
            {
                var fact = new MgdServiceFactory();
                MgdResourceService service = (MgdResourceService)fact.CreateService(MgServiceType.ResourceService);
                MgResourceIdentifier mapres1 = new MgResourceIdentifier("Library://UnitTests/Data/Shuttle.DrawingSource");
                service.DeleteResource(mapres1);

                if (service.ResourceExists(resourceIdentifier))
                    service.DeleteResource(resourceIdentifier);

                if (service.ResourceExists(resourceIdentifier2))
                    service.DeleteResource(resourceIdentifier2);

                if (service.ResourceExists(resourceIdentifier3))
                    service.DeleteResource(resourceIdentifier3);

                if (service.ResourceExists(resourceIdentifier4))
                    service.DeleteResource(resourceIdentifier4);
            }
            catch (MgException ex)
            {
                ex.Dispose();
            }
        }
开发者ID:kanbang,项目名称:Colt,代码行数:26,代码来源:ResourceServiceTests.cs


示例11: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var fact = new MgdServiceFactory();
                MgdRenderingService renSvc = (MgdRenderingService)fact.CreateService(MgServiceType.RenderingService);

                MgResourceIdentifier mdfId = new MgResourceIdentifier(txtMapDefinition.Text);
                var sw = new Stopwatch();
                sw.Start();
                MgdMap map = new MgdMap(mdfId);
                sw.Stop();
                Trace.TraceInformation("Runtime map created in {0}ms", sw.ElapsedMilliseconds);

                map.SetViewScale(Convert.ToDouble(txtScale.Text));
                sw.Reset();
                sw.Start();
                MgByteReader response = renSvc.RenderTile(map, txtBaseGroup.Text, Convert.ToInt32(txtCol.Text), Convert.ToInt32(txtRow.Text));
                sw.Stop();
                Trace.TraceInformation("RenderTile executed in {0}ms", sw.ElapsedMilliseconds);
                new ImageResponseDialog(response).ShowDialog();
            }
            catch (MgException ex)
            {
                MessageBox.Show(ex.ToString(), "Error from MapGuide");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error");
            }
        }
开发者ID:kanbang,项目名称:Colt,代码行数:31,代码来源:RenderTileControl.cs


示例12: SetResourceFromXml

 public static void SetResourceFromXml(HtzMgHelper helper, MgResourceIdentifier resourceId, XmlDocument doc)
 {
     byte[] layerDef = new UTF8Encoding().GetBytes(doc.InnerXml);
     MgByteSource byteSource = new MgByteSource(layerDef, layerDef.Length);
     byteSource.SetMimeType("text/xml");
     helper.ResourceService.SetResource(resourceId, byteSource.GetReader(), null);
 }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:7,代码来源:ResourceHelper.cs


示例13: btnReload_Click

 private void btnReload_Click(object sender, EventArgs e)
 {
     _viewer.ClearSelection();
     MgResourceIdentifier mdfId = new MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
     MgdMap map = new MgdMap(mdfId);
     MgDesktopMapViewerProvider provider = new MgDesktopMapViewerProvider(map);
     Shell.Instance.ReloadViewer(provider);
 }
开发者ID:kanbang,项目名称:Colt,代码行数:8,代码来源:SamplesTaskPane.cs


示例14: GetResourceXml

 // Methods
 public static XmlDocument GetResourceXml(HtzMgHelper helper, MgResourceIdentifier resourceId)
 {
     XmlDocument result = new XmlDocument();
     if (resourceId != null)
     {
         result.LoadXml(helper.ResourceService.GetResourceContent(resourceId).ToString());
     }
     return result;
 }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:10,代码来源:ResourceHelper.cs


示例15: AddPointFeature

 public static void AddPointFeature(string FeatureName, MgPropertyCollection featureProps, MgPoint geom, MgFeatureService featureSrvc, MgResourceIdentifier dataSourceId)
 {
     MgByteReader geomReader = new MgAgfReaderWriter().Write(geom);
     MgGeometryProperty geometryProp = new MgGeometryProperty("GEOM", geomReader);
     featureProps.Add(geometryProp);
     MgInsertFeatures cmd = new MgInsertFeatures(FeatureName, featureProps);
     MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
     commands.Add(cmd);
     ReleaseReader(featureSrvc.UpdateFeatures(dataSourceId, commands, false));
 }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:10,代码来源:GService.asmx.cs


示例16: HtzMgHelper

 public HtzMgHelper(string userName, string userPass, string layoutId, string mapDefinition)
 {
     Init();
     this._connection = new MgSiteConnection();
     this._connection.Open(new MgUserInformation(userName, userPass));
     this._sessionId = this._connection.GetSite().CreateSession();
     this._map = new MgMap();
     MgResourceIdentifier mapDef = new MgResourceIdentifier(mapDefinition);
     this._map.Create(this.ResourceService, mapDef, mapDef.Name);
     this._layoutId = layoutId;
 }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:11,代码来源:HtzMgHelper.cs


示例17: Main

        static void Main(string [] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            
            //Must call MgPlatform.Initialize() before we can work with anything from the MapGuide API
            try
            {
                var sw = new Stopwatch();
                sw.Start();
                MgdPlatform.Initialize("Platform.ini");
                sw.Stop();
                Trace.TraceInformation("Platform initialization took {0}ms", sw.ElapsedMilliseconds);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error");
                return;
            }
            
            //MgAppWindow is our Main Window class full of drag-and-drop component goodness. Go ahead and
            //take a look at MgAppWindow.cs source, not much code there except for the 3 generic invoke components and the
            //single custom selection handler. Everything else is encapsulated by designer-friendly drag and drop components
            //Most of the work is dragging and dropping components into the designer surface, and setting lots of properties
            var frm = new MgAppWindow();
            
            //We can initialize without specifying a map (allowing for components that do not 
            //require a loaded map to still be used). You just have to call LoadMap() on the MgMapViewer
            //instance when ready (not demonstrated here). So if you do load a package here, you will
            //have to restart the application
            MgResourceIdentifier resId = null;
            if (args.Length == 1)
            {
                resId = new MgResourceIdentifier(args[0]);
                resId.Validate();
            }

            var fact = new MgdServiceFactory();
            var resSvc = (MgdResourceService)fact.CreateService(MgServiceType.ResourceService);
            MgdMap map = null;

            if (resId != null && resSvc.ResourceExists(resId))
                map = new MgdMap(resId);

            //This is just a pass-through call to MgMapViewer.Init()
            frm.LoadMap(new MgDesktopMapViewerProvider(map));

            Application.ApplicationExit += new EventHandler(OnAppExit);
            Application.Run(frm);
        }
开发者ID:kanbang,项目名称:Colt,代码行数:51,代码来源:Program.cs


示例18: HtzMaintenanceHelper

 // Methods
 public HtzMaintenanceHelper(HtzMgHelper helper, MgLayer parentLayer, string uidKey)
 {
     this.ModuleAllowed = true;
     this.InitDefaultInfraTypes();
     this._helper = helper;
     this._uidKey = string.IsNullOrEmpty(uidKey) ? "UID" : uidKey;
     this._parentLayer = parentLayer;
     //if (this._helper.Configuration != null)
     //{
     //    this._config = this._helper.Configuration.GetProperties("FeatureCard");
     //    Dictionary<string, string> tmp = new Dictionary<string, string>();
     //    foreach (KeyValuePair<string, string> item in this._infraTypes)
     //    {
     //        if (!this._config.ContainsKey("ShowMaintFor" + item.Key))
     //        {
     //            this._helper.Configuration.RegisterPropertyDefinition("FeatureCard", "ShowMaintFor" + item.Key, item.Value, ConfigPropertyType.Boolean, "תחזוקה - הצגת שכבות", false);
     //        }
     //        else if ((bool)this._config["ShowMaintFor" + item.Key].Value)
     //        {
     //            tmp.Add(item.Key, item.Value);
     //        }
     //    }
     //    this._infraTypes = tmp;
     //}
     string mapPath = this._helper.Map.MapDefinition.Path;
     if (mapPath.LastIndexOf("/Maps") < 0)
     {
         this.ModuleAllowed = false;
     }
     else
     {
         this._maintenancePath = mapPath.Substring(0, mapPath.IndexOf("/Maps"));
         this._sdfResId = new MgResourceIdentifier(string.Format("Library://{0}/Maintenance/Data/Maintenance.FeatureSource", this._maintenancePath));
         this._layersResId = new List<MgResourceIdentifier>();
         if (!this._helper.ResourceService.ResourceExists(this._sdfResId))
         {
             this.CreateSdf(this._sdfResId);
         }
         foreach (KeyValuePair<string, string> item in this._infraTypes)
         {
             MgResourceIdentifier resId = new MgResourceIdentifier(string.Format("Library://{0}/Maintenance/Layers/Maint_{1}.LayerDefinition", this._maintenancePath, item.Key));
             this._layersResId.Add(resId);
             if (!this._helper.ResourceService.ResourceExists(resId))
             {
                 this.CreateLayer(resId, string.Format("InfrastructureType='{0}'", item.Value));
             }
         }
         this.AttachLayers();
         this._infraTypes.Add("none", "בחר מרשימה");
     }
 }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:52,代码来源:HtzMaintenanceHelper.cs


示例19: CreateLocationMarkerFeatureSource

    // Create a temporary Feature Source to store geocode results.
    public void CreateLocationMarkerFeatureSource(MgFeatureService featureService, MgResourceIdentifier locationMarkerDataResId, MgMap map)
    {
        //String ll84Wkt = "GEOGCS[\"LL84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degrees\",1]]";
        //string ll84Wkt = "LOCAL_CS[\"*XY-MT*\",LOCAL_DATUM[\"*X-Y*\",10000],UNIT[\"Meter\", 1],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]] ";
        MgCoordinateSystemFactory sysCoordsFactory = new MgCoordinateSystemFactory();
        string srsDefMap = map.GetMapSRS();
        string mapSrsUnits = string.Empty;

        srsDefMap = !string.IsNullOrEmpty(srsDefMap) ? srsDefMap : "LOCAL_CS[\"*XY-MT*\",LOCAL_DATUM[\"*X-Y*\",10000],UNIT[\"Meter\", 1],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]] ";

        MgCoordinateSystem srsMap = sysCoordsFactory.Create(srsDefMap);
        MgClassDefinition locationClass = new MgClassDefinition();
        locationClass.SetName("LocationMarker");
        MgPropertyDefinitionCollection properties = locationClass.GetProperties();

        MgDataPropertyDefinition idProperty = new MgDataPropertyDefinition("ID");
        idProperty.SetDataType(MgPropertyType.Int32);
        idProperty.SetReadOnly(true);
        idProperty.SetNullable(false);
        idProperty.SetAutoGeneration(true);
        properties.Add(idProperty);

        MgDataPropertyDefinition addressProperty = new MgDataPropertyDefinition("Address");
        addressProperty.SetDataType(MgPropertyType.String);
        addressProperty.SetLength(512);
        properties.Add(addressProperty);

        MgGeometricPropertyDefinition locationProperty = new MgGeometricPropertyDefinition("Location");
        locationProperty.SetGeometryTypes(MgGeometryType.Point);
        locationProperty.SetHasElevation(false);
        locationProperty.SetHasMeasure(false);
        locationProperty.SetReadOnly(false);
        locationProperty.SetSpatialContextAssociation(srsMap.GetCsCode());
        properties.Add(locationProperty);

        MgPropertyDefinitionCollection idProperties = locationClass.GetIdentityProperties();
        idProperties.Add(idProperty);

        locationClass.SetDefaultGeometryPropertyName("Location");

        MgFeatureSchema locationSchema = new MgFeatureSchema();
        locationSchema.SetName("LocationMarkerSchema");
        locationSchema.GetClasses().Add(locationClass);

        MgCreateSdfParams sdfParams = new MgCreateSdfParams(srsMap.GetCsCode(), srsDefMap, locationSchema);

        featureService.CreateFeatureSource(locationMarkerDataResId, sdfParams);
    }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:49,代码来源:findlocationfunctions.cs


示例20: CreateBufferLayer

        public MgdLayer CreateBufferLayer(MgResourceService resourceService, MgResourceIdentifier bufferFeatureResId, String sessionId)
        {
            // Load the layer definition template into
            // a XmlDocument object, find the "ResourceId" element, and
            // modify its content to reference the temporary
            // feature source.

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(Layers.BufferLayerDefinition);
            XmlNode featureSourceNode = doc.GetElementsByTagName("ResourceId")[0];
            featureSourceNode.InnerText = bufferFeatureResId.ToString();

            // Get the updated layer definition from the XmlDocument
            // and save it to the session repository using the
            // ResourceService object.

            MgByteSource byteSource = null;
            using (MemoryStream ms = new MemoryStream())
            {
                doc.Save(ms);
                ms.Position = 0L;

                //Note we do this to ensure our XML content is free of any BOM characters
                byte[] layerDefinition = ms.ToArray();
                Encoding utf8 = Encoding.UTF8;
                String layerDefStr = new String(utf8.GetChars(layerDefinition));
                layerDefinition = new byte[layerDefStr.Length - 1];
                int byteCount = utf8.GetBytes(layerDefStr, 1, layerDefStr.Length - 1, layerDefinition, 0);

                byteSource = new MgByteSource(layerDefinition, layerDefinition.Length);
                byteSource.SetMimeType(MgMimeType.Xml);
            }

            MgResourceIdentifier tempLayerResId = new MgResourceIdentifier("Session:" + sessionId + "//Buffer.LayerDefinition");

            resourceService.SetResource(tempLayerResId, byteSource.GetReader(), null);

            // Create an MgLayer object based on the new layer definition
            // and return it to the caller.

            MgdLayer bufferLayer = new MgdLayer(tempLayerResId, resourceService);
            bufferLayer.SetName("Buffer");
            bufferLayer.SetLegendLabel("Buffer");
            bufferLayer.SetDisplayInLegend(true);
            bufferLayer.SetSelectable(false);

            return bufferLayer;
        }
开发者ID:kanbang,项目名称:Colt,代码行数:48,代码来源:BufferHelper.cs



注:本文中的MgResourceIdentifier类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MgaFCO类代码示例发布时间:2022-05-24
下一篇:
C# MetroWindow类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap