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);
        }
Exemplo n.º 2
0
        public object ESRI_Attributes_Get(ResultBuffer rb)
        {
            object result;

            try
            {
                ObjectId argument = LspUtil.GetArgument(rb, 0, ObjectId.Null);
                if (argument == ObjectId.Null)
                {
                    result = null;
                }
                else
                {
                    string          assocParam   = LspUtil.GetAssocParam(rb, "FCNAME", null);
                    string          assocParam2  = LspUtil.GetAssocParam(rb, "STNAME", null);
                    string          fieldName    = LspUtil.GetAssocParam(rb, "FIELDNAME", null);
                    MSCFeatureClass featureClass = this.GetFeatureClass(assocParam, assocParam2);
                    List <CadField> list;
                    if (featureClass == null)
                    {
                        list = CadField.EntityCadFields(argument);
                    }
                    else
                    {
                        list = featureClass.GetEntityFields(argument);
                    }
                    if (!string.IsNullOrEmpty(fieldName))
                    {
                        list = (from x in list
                                where x.Name == fieldName
                                select x).ToList <CadField>();
                    }
                    if (list.Count == 0)
                    {
                        result = null;
                    }
                    else
                    {
                        List <TypedValue> list2 = new List <TypedValue>();
                        list2.Add(new TypedValue(5016, null));
                        foreach (CadField current in list)
                        {
                            LspUtil.AppendDottedPair(ref list2, current.Name, current.Value.Value);
                        }
                        list2.Add(new TypedValue(5017, null));
                        ResultBuffer resultBuffer = new ResultBuffer(list2.ToArray());
                        result = resultBuffer;
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
Exemplo n.º 3
0
 public static void AppendDottedPair(ref List <TypedValue> list, string key, object value)
 {
     if (value == null)
     {
         return;
     }
     if (value is TypedValue)
     {
         TypedValue typedValue = (TypedValue)value;
         LspUtil.AppendDottedPair(ref list, key, (int)typedValue.TypeCode, typedValue.Value);
         return;
     }
     if (value is string)
     {
         string value2 = value.ToString();
         if (!string.IsNullOrEmpty(value2))
         {
             LspUtil.AppendDottedPair(ref list, key, 5005, value);
             return;
         }
     }
     else
     {
         if (value is short)
         {
             LspUtil.AppendDottedPair(ref list, key, 5003, value);
             return;
         }
         if (value is int)
         {
             LspUtil.AppendDottedPair(ref list, key, 5010, value);
             return;
         }
         if (value is double)
         {
             LspUtil.AppendDottedPair(ref list, key, 5001, value);
             return;
         }
         if (value is bool)
         {
             try
             {
                 LspUtil.AppendDottedPair(ref list, key, 5003, Convert.ToInt16((bool)value));
                 return;
             }
             catch
             {
                 return;
             }
         }
         if (value is bool)
         {
             try
             {
                 LspUtil.AppendDottedPair(ref list, key, 5003, Convert.ToInt16((bool)value));
                 return;
             }
             catch
             {
                 return;
             }
         }
         if (value is Extent)
         {
             Extent  extent   = (Extent)value;
             Point2d minPoint = extent.MinPoint;
             Point2d maxPoint = extent.MaxPoint;
             LspUtil.AppendDottedPair(ref list, key + "MIN", 5002, minPoint);
             LspUtil.AppendDottedPair(ref list, key + "MAX", 5002, maxPoint);
             return;
         }
         try
         {
             string text = value.ToString();
             if (!string.IsNullOrEmpty(text))
             {
                 LspUtil.AppendDottedPair(ref list, key, 5005, text);
             }
         }
         catch
         {
         }
     }
 }
Exemplo n.º 4
0
 public static void AppendDottedPair(ref List <TypedValue> list, string key, int type2, object value2)
 {
     LspUtil.AppendDottedPair(ref list, 5005, key, type2, value2);
 }
Exemplo n.º 5
0
        public object ESRI_GetFeatureClassFieldDefinition(ResultBuffer rb)
        {
            object result;

            try
            {
                TypedValue[] array = rb.AsArray();
                if (array.Count <TypedValue>() < 2)
                {
                    result = null;
                }
                else
                {
                    TypedValue typedValue = array[0];
                    if (typedValue.TypeCode != 5005)
                    {
                        result = null;
                    }
                    else
                    {
                        string name        = typedValue.Value.ToString();
                        string subtypeName = null;
                        if (array.Count <TypedValue>() == 3)
                        {
                            TypedValue typedValue2 = array[2];
                            if (typedValue2.TypeCode != 5005)
                            {
                                result = null;
                                return(result);
                            }
                            subtypeName = typedValue2.Value.ToString();
                        }
                        MSCFeatureClass featureClassOrService = this.GetFeatureClassOrService(name, subtypeName);
                        if (featureClassOrService == null)
                        {
                            result = null;
                        }
                        else
                        {
                            TypedValue typedValue3 = array[1];
                            if (typedValue3.TypeCode != 5005)
                            {
                                result = null;
                            }
                            else
                            {
                                string fieldName = typedValue3.Value.ToString();
                                if (featureClassOrService.Fields.Count == 0)
                                {
                                    result = null;
                                }
                                else
                                {
                                    CadField cadField = FeatureClassAPI.FindField(featureClassOrService.Fields, fieldName);
                                    if (cadField == null)
                                    {
                                        result = null;
                                    }
                                    else
                                    {
                                        List <TypedValue> list = new List <TypedValue>();
                                        list.Add(new TypedValue(5016, null));
                                        LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, cadField.Name);
                                        LspUtil.AppendDottedPair(ref list, 5005, "TYPE", 5005, CadField.CodeString((int)cadField.FieldType));
                                        LspUtil.AppendDottedPair(ref list, 5005, "RO", 5003, cadField.ReadOnly);
                                        if (cadField.FieldType == CadField.CadFieldType.String)
                                        {
                                            LspUtil.AppendDottedPair(ref list, 5005, "LENGTH", 5003, cadField.Length);
                                        }
                                        LspUtil.AppendDottedPair(ref list, "VALUE", cadField.Value);
                                        list.Add(new TypedValue(5017, null));
                                        ResultBuffer resultBuffer = new ResultBuffer(list.ToArray());
                                        result = resultBuffer;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
        public object ESRI_GetConnection(ResultBuffer rb)
        {
            object result;

            try
            {
                TypedValue[] array = rb.AsArray();
                if (array.Count <TypedValue>() < 1)
                {
                    result = null;
                }
                else
                {
                    TypedValue typedValue = array[0];
                    if (typedValue.TypeCode != 5005)
                    {
                        result = null;
                    }
                    else
                    {
                        string b = typedValue.Value.ToString();
                        if (!AGSConnection.bConnectionsLoaded)
                        {
                            AGSConnection.LoadConnections();
                        }
                        if (App.Connections.Count > 0)
                        {
                            foreach (AGSConnection current in App.Connections)
                            {
                                if (string.Equals(current.Name, b, StringComparison.CurrentCultureIgnoreCase))
                                {
                                    List <TypedValue> list = new List <TypedValue>();
                                    list.Add(new TypedValue(5016, null));
                                    LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, current.Name);
                                    LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, current.URL);
                                    if (!string.IsNullOrEmpty(current.Version))
                                    {
                                        LspUtil.AppendDottedPair(ref list, 5005, "VERSION", 5005, current.Version.ToString());
                                    }
                                    if (!string.IsNullOrEmpty(current.UserName))
                                    {
                                        LspUtil.AppendDottedPair(ref list, 5005, "USER", 5005, current.UserName);
                                    }
                                    list.Add(new TypedValue(5017, null));
                                    ResultBuffer resultBuffer = new ResultBuffer(list.ToArray());
                                    result = resultBuffer;
                                    return(result);
                                }
                            }
                            result = null;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
        public object ESRI_Image_Get(ResultBuffer rb)
        {
            object result;

            try
            {
                string          argument        = LspUtil.GetArgument(rb, 0, null);
                MSCImageService mSCImageService = null;
                if (!string.IsNullOrEmpty(argument))
                {
                    mSCImageService = this.GetImageService(argument);
                }
                else
                {
                    mSCImageService = AfaDocData.ActiveDocData.CurrentImageService;
                }
                if (mSCImageService == null)
                {
                    result = null;
                }
                else
                {
                    List <TypedValue> list = new List <TypedValue>();
                    list.Add(new TypedValue(5016, null));
                    if (mSCImageService.ExportOptions != null)
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "DYNAMIC", 5003, mSCImageService.ExportOptions.Dynamic);
                        LspUtil.AppendDottedPair(ref list, 5005, "TRANSPARENCY", 5003, mSCImageService.ExportOptions.Transparency);
                        try
                        {
                            if (mSCImageService.BoundaryExtent.IsValid())
                            {
                                LspUtil.AppendDottedPair(ref list, "EXT", mSCImageService.BoundaryExtent);
                            }
                        }
                        catch
                        {
                        }
                        LspUtil.AppendDottedPair(ref list, 5005, "VISIBILE", 5003, mSCImageService.GetVisibility());
                        if (!string.IsNullOrEmpty(mSCImageService.ExportOptions.Format))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "FORMAT", 5005, mSCImageService.ExportOptions.Format);
                        }
                        if (!string.IsNullOrEmpty(mSCImageService.ConnectionURL))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCImageService.RestEndpoint);
                        }
                        if (!string.IsNullOrEmpty(mSCImageService.RestEndpoint))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "RESTURL", 5005, mSCImageService.RestEndpoint);
                        }
                        LspUtil.AppendDottedPair(ref list, "COMPRESSION", mSCImageService.ExportOptions.TransCompression);
                        LspUtil.AppendDottedPair(ref list, "MOSAICMETHOD", mSCImageService.ExportOptions.MosaicMethod);
                        LspUtil.AppendDottedPair(ref list, "MOSAICOPERATOR", mSCImageService.ExportOptions.MosaicOperator);
                        LspUtil.AppendDottedPair(ref list, "MOSAICRULE", mSCImageService.ExportOptions.MosaicRule);
                        LspUtil.AppendDottedPair(ref list, "ASCENDING", mSCImageService.ExportOptions.Ascending);
                        LspUtil.AppendDottedPair(ref list, "BANDIDS", mSCImageService.ExportOptions.BandIds);
                        LspUtil.AppendDottedPair(ref list, "INTERPOLATION", mSCImageService.ExportOptions.Interpolation);
                        LspUtil.AppendDottedPair(ref list, "LOCKRASTERID", mSCImageService.ExportOptions.LockRasterID);
                        LspUtil.AppendDottedPair(ref list, "NODATAVALUE", mSCImageService.ExportOptions.NoDataValue);
                        LspUtil.AppendDottedPair(ref list, "ORDERBASEVALUE", mSCImageService.ExportOptions.OrderBaseValue);
                        LspUtil.AppendDottedPair(ref list, "ORDERFIELD", mSCImageService.ExportOptions.OrderField);
                        LspUtil.AppendDottedPair(ref list, "RENDERINGRULE", mSCImageService.ExportOptions.RenderingRule);
                        LspUtil.AppendDottedPair(ref list, "PIXELTYPE", mSCImageService.ExportOptions.PixelType);
                        LspUtil.AppendDottedPair(ref list, "QUALITY", mSCImageService.ExportOptions.Quality);
                    }
                    LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCImageService.Name);
                    LspUtil.AppendDottedPair(ref list, 5005, "ENAME", 5006, mSCImageService.RasterObjectId);
                    if (!string.IsNullOrEmpty(mSCImageService.ConnectionURL))
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCImageService.ConnectionURL);
                    }
                    try
                    {
                        AGSConnection parent = mSCImageService.ParentService.Parent;
                        if (!string.IsNullOrEmpty(parent.Name))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name);
                        }
                    }
                    catch
                    {
                    }
                    try
                    {
                        if (!string.IsNullOrEmpty(mSCImageService.CurrentFileName))
                        {
                            LspUtil.AppendDottedPair(ref list, "CURRENTFILE", 5005, mSCImageService.CurrentFileName);
                        }
                        mSCImageService.ParentService.GetWKT();
                        if (mSCImageService.ParentService != null)
                        {
                            foreach (KeyValuePair <string, object> current in mSCImageService.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);
        }
        public object ESRI_Map_Get(ResultBuffer rb)
        {
            object result;

            try
            {
                string        argument      = LspUtil.GetArgument(rb, 0, null);
                MSCMapService mSCMapService = null;
                if (!string.IsNullOrEmpty(argument))
                {
                    mSCMapService = this.GetMapService(argument);
                }
                else
                {
                    mSCMapService = AfaDocData.ActiveDocData.CurrentMapService;
                }
                if (mSCMapService == null)
                {
                    result = null;
                }
                else
                {
                    List <TypedValue> list = new List <TypedValue>();
                    list.Add(new TypedValue(5016, null));
                    if (mSCMapService.ExportOptions != null)
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "DYNAMIC", 5003, mSCMapService.ExportOptions.Dynamic);
                        LspUtil.AppendDottedPair(ref list, 5005, "TRANSPARENCY", 5003, mSCMapService.ExportOptions.Transparency);
                        try
                        {
                            if (mSCMapService.BoundaryExtent.IsValid())
                            {
                                LspUtil.AppendDottedPair(ref list, "EXT", mSCMapService.BoundaryExtent);
                            }
                        }
                        catch
                        {
                        }
                        if (!string.IsNullOrEmpty(mSCMapService.ExportOptions.Format))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "FORMAT", 5005, mSCMapService.ExportOptions.Format);
                        }
                    }
                    LspUtil.AppendDottedPair(ref list, 5005, "VISIBILE", 5003, mSCMapService.GetVisibility());
                    LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCMapService.Name);
                    LspUtil.AppendDottedPair(ref list, 5005, "ENAME", 5006, mSCMapService.RasterObjectId);
                    if (!string.IsNullOrEmpty(mSCMapService.ConnectionURL))
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCMapService.ConnectionURL);
                    }
                    if (!string.IsNullOrEmpty(mSCMapService.RestEndpoint))
                    {
                        LspUtil.AppendDottedPair(ref list, 5005, "RESTURL", 5005, mSCMapService.RestEndpoint);
                    }
                    try
                    {
                        AGSConnection parent = mSCMapService.ParentService.Parent;
                        if (!string.IsNullOrEmpty(parent.Name))
                        {
                            LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name);
                        }
                    }
                    catch
                    {
                    }
                    try
                    {
                        if (!string.IsNullOrEmpty(mSCMapService.CurrentFileName))
                        {
                            LspUtil.AppendDottedPair(ref list, "CURRENTFILE", 5005, mSCMapService.CurrentFileName);
                        }
                        mSCMapService.ParentService.GetWKT();
                        if (mSCMapService.ParentService != null)
                        {
                            foreach (KeyValuePair <string, object> current in mSCMapService.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);
        }
        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);
        }