Exemplo n.º 1
0
        public object ESRI_FeatureClass_Get(ResultBuffer rb)
        {
            object result;

            try
            {
                string          argument = LspUtil.GetArgument(rb, 0, null);
                MSCFeatureClass mSCFeatureClass;
                if (!string.IsNullOrEmpty(argument))
                {
                    mSCFeatureClass = this.GetFeatureClassOrService(argument);
                }
                else
                {
                    mSCFeatureClass = this.GetCurrentFeatureClassOrService();
                }
                if (mSCFeatureClass == null)
                {
                    result = null;
                }
                else
                {
                    string argument2 = LspUtil.GetArgument(rb, 1, null);
                    if (argument2 != null)
                    {
                        mSCFeatureClass = mSCFeatureClass.FindSubtypeName(argument2);
                    }
                    if (mSCFeatureClass == null)
                    {
                        result = null;
                    }
                    else
                    {
                        List <TypedValue> list = new List <TypedValue>();
                        list.Add(new TypedValue(5016, null));
                        LspUtil.AppendDottedPair(ref list, "NAME", mSCFeatureClass.Name);
                        LspUtil.AppendDottedPair(ref list, "GEOMTYPE", MSCFeatureClass.GetGeomString(mSCFeatureClass.GeometryType));
                        if (!string.IsNullOrEmpty(mSCFeatureClass.TypeField))
                        {
                            LspUtil.AppendDottedPair(ref list, "TYPEFIELD", mSCFeatureClass.TypeField);
                        }
                        if (mSCFeatureClass.IsSingleLayerQuery())
                        {
                            LspUtil.AppendDottedPair(ref list, "CADLAYER", mSCFeatureClass.GetFirstLayerFromQuery());
                        }
                        list.Add(new TypedValue(5017, null));
                        ResultBuffer resultBuffer = new ResultBuffer(list.ToArray());
                        result = resultBuffer;
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
        public object ESRI_FeatureService_Get(ResultBuffer rb)
        {
            object result;

            try
            {
                string            argument          = LspUtil.GetArgument(rb, 0, null);
                MSCFeatureService mSCFeatureService = null;
                if (!string.IsNullOrEmpty(argument))
                {
                    mSCFeatureService = this.GetFeatureService(argument);
                }
                else
                {
                    mSCFeatureService = this.GetCurrentFeatureService();
                }
                if (mSCFeatureService == null)
                {
                    result = null;
                }
                else
                {
                    List <TypedValue> list = new List <TypedValue>();
                    list.Add(new TypedValue(5016, null));
                    LspUtil.AppendDottedPair(ref list, "SERVICENAME", mSCFeatureService.Name);
                    LspUtil.AppendDottedPair(ref list, "GEOMTYPE", MSCFeatureClass.GetGeomString(mSCFeatureService.GeometryType));
                    if (!string.IsNullOrEmpty(mSCFeatureService.TypeField))
                    {
                        LspUtil.AppendDottedPair(ref list, "TYPEFIELD", mSCFeatureService.TypeField);
                    }
                    LspUtil.AppendDottedPair(ref list, "CADLAYER", mSCFeatureService.LayerName);
                    LspUtil.AppendDottedPair(ref list, "LAYERID", mSCFeatureService.ServiceLayerID);
                    if (mSCFeatureService.ExportOptions != null)
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "EDITMODE", 5003, mSCFeatureService.ExportOptions.Dynamic);
                        try
                        {
                            if (mSCFeatureService.ExportOptions.BoundingBox.IsValid())
                            {
                                LspUtil.AppendDottedPair(ref list, "EXT", mSCFeatureService.ExportOptions.BoundingBox);
                            }
                        }
                        catch
                        {
                        }
                    }
                    LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCFeatureService.Name);
                    if (!string.IsNullOrEmpty(mSCFeatureService.ConnectionURL))
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCFeatureService.ConnectionURL);
                    }
                    try
                    {
                        AGSConnection parent = mSCFeatureService.ParentService.Parent;
                        if (!string.IsNullOrEmpty(parent.Name))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name);
                        }
                    }
                    catch
                    {
                    }
                    try
                    {
                        mSCFeatureService.ParentService.GetWKT();
                        if (mSCFeatureService.ParentService != null)
                        {
                            foreach (KeyValuePair <string, object> current in mSCFeatureService.ParentService.Properties)
                            {
                                try
                                {
                                    LspUtil.AppendDottedPair(ref list, current.Key, current.Value);
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                    list.Add(new TypedValue(5017, null));
                    ResultBuffer resultBuffer = new ResultBuffer(list.ToArray());
                    result = resultBuffer;
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }