本文整理汇总了C#中PropertySet.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# PropertySet.SetProperty方法的具体用法?C# PropertySet.SetProperty怎么用?C# PropertySet.SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertySet
的用法示例。
在下文中一共展示了PropertySet.SetProperty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: axMapControl1_OnMouseDown
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
//IMapDocument mxd;
string x;
x = e.mapX.ToString("#########.########");
string y;
y = e.mapY.ToString("#########.########");
string data;
data = "";
data += string.Format("The map has x coordinate {0} \n y coordinate {1}", x, y);
Form1 msgForm = new Form1();
msgForm.label1.Text = data;
//msgForm.ShowDialog();
IPropertySet location = new PropertySet();
location.SetProperty("ps","C:\\Users\\AlexanderN\\Documents\\ArcGIS\\Points.gdb");
string featureBuffer = "C:\\Users\\AlexanderN\\Documents\\ArcGIS\\Points.gdb\\Buffer";
string featurePoint = "C:\\Users\\AlexanderN\\Documents\\ArcGIS\\Points.gdb\\AdditionalPoint";
IFeatureWorkspace ws;
IFeature newPoint = ws.OpenFeatureClass(featurePoint) as IFeature;
IFeature newBuffer = ws.OpenFeatureClass(featureBuffer) as IFeature;
Geom.IPoint point = new Geom.PointClass();
point.PutCoords(e.mapX, e.mapY);
newPoint.Shape = point;
IFeatureClass pointFC = newPoint as IFeatureClass;
newPoint.Store();
}
示例2: AgsConnect_Works
public void AgsConnect_Works()
{
var connectionFactory = (IAGSServerConnectionFactory2) new AGSServerConnectionFactory();
IPropertySet connectionProps = new PropertySet();
connectionProps.SetProperty("URL", address);
IAGSServerConnection gisServer = connectionFactory.Open(connectionProps, 0);
Assert.That(gisServer, Is.Not.Null);
}
示例3: Connect
public override IWorkspace Connect()
{
var propertySet = new PropertySet();
propertySet.SetProperty("SERVER", Information.ServerName);
propertySet.SetProperty("INSTANCE", Information.InstanceName);
propertySet.SetProperty("DATABASE", Information.DatabaseName);
propertySet.SetProperty("USER", Information.Name);
propertySet.SetProperty("PASSWORD", Information.Password);
propertySet.SetProperty("VERSION", Information.Version);
var workspaceFactory = new SdeWorkspaceFactory();
var workspace = workspaceFactory.Open(propertySet, 0);
return workspace;
}
示例4: SampleOperHandler
private byte[] SampleOperHandler(NameValueCollection boundVariables,
JsonObject operationInput,
string outputFormat,
string requestProperties,
out string responseProperties)
{
responseProperties = null;
string parm1Value;
bool found = operationInput.TryGetString("parm1", out parm1Value);
if (!found || string.IsNullOrEmpty(parm1Value))
throw new ArgumentNullException("parm1");
string parm2Value;
found = operationInput.TryGetString("parm2", out parm2Value);
if (!found || string.IsNullOrEmpty(parm2Value))
throw new ArgumentNullException("parm2");
string outputSTR = null;
IPropertySet propertySet = new PropertySet();
propertySet.SetProperty("URL", "http://localhost:6080/arcgis/admin");
propertySet.SetProperty("USER", "yourServerAdminUsername") ;
propertySet.SetProperty("PASSWORD", "yourServerAdminPassword");
propertySet.SetProperty("ConnectionMode", esriAGSConnectionMode.esriAGSConnectionModeAdmin);
propertySet.SetProperty("ServerType", esriAGSServerType.esriAGSServerTypeDiscovery);
IAGSServerConnectionFactory agsServerConnectionFactory = new AGSServerConnectionFactory();
IAGSServerConnectionAdmin agsServerConnection = agsServerConnectionFactory.Open(propertySet, 0) as IAGSServerConnectionAdmin;
IServerObjectAdmin servAdmin = agsServerConnection.ServerObjectAdmin;
IEnumServerDirectory pEnumServDir = servAdmin.GetServerDirectories();
pEnumServDir.Reset();
IServerDirectory2 pServDir = pEnumServDir.Next() as IServerDirectory2;
while (pServDir != null)
{
string cleaningMd = pServDir.CleaningMode.ToString(); //cleanup mode
string descrip = pServDir.Description.ToString(); //Description
int fileAge = pServDir.MaxFileAge; //Max File Age
string path = pServDir.Path; //physical path
string url = pServDir.URL; //virtual path
string type = pServDir.Type.ToString();
pServDir = pEnumServDir.Next() as IServerDirectory2;
outputSTR = outputSTR + "cleanup mode: " + cleaningMd + "\n" + "Description: " + descrip + "\n" + "Max File Age: " + fileAge + "\n" + "physical path: " + path + "\n" + "virtual path: " + url + "\n" + "type: " + type.ToString() + "\r\n";
}
JsonObject result = new JsonObject();
result.AddString("parm1", parm1Value);
result.AddString("parm2", outputSTR);
return Encoding.UTF8.GetBytes(result.ToJson());
}
示例5: addWebMappingServiceToMap
internal void addWebMappingServiceToMap(Uri WMS_URI)
{
try
{
// create a new WMS layer for the ArcMap session
IWMSGroupLayer wmsMapLayer = new WMSMapLayer() as IWMSGroupLayer;
IWMSConnectionName connName = new WMSConnectionName();
// set the property of the WMS layer to the Google Maps Engine
// WMS GetCapabilities URL
IPropertySet propSet = new PropertySet();
propSet.SetProperty("URL", WMS_URI.ToString());
connName.ConnectionProperties = propSet;
// create a new data layer for the WMS layer to use
IDataLayer dataLayer = wmsMapLayer as IDataLayer;
dataLayer.Connect((IName)connName);
// create a new ArcMap layer and add the WMS. Set the name.
IWMSServiceDescription serviceDesc = wmsMapLayer.WMSServiceDescription;
ILayer layer = wmsMapLayer as ILayer;
layer.Name = serviceDesc.WMSTitle;
// add the WMS layer to the ArcMap session
m_map.AddLayer(layer);
}
catch (System.Exception ex)
{
// an error occured and was not able to add the WMS layer to the map
log.Error(ex);
System.Windows.Forms.MessageBox.Show("Unable to add a WMS layer to the map.");
}
}
开发者ID:GeoRab,项目名称:mapsengine-arcgis-connector,代码行数:34,代码来源:GoogleMapsEngineToolsExtensionForArcGIS.cs
示例6: OpenOleDbWorkspace
private void OpenOleDbWorkspace(string tempMdbPathName, string datasetName, ref IWorkspaceFactory workspaceFactory,
out IDataset attributeDataset, out ITable exportAttributes)
{
if (!File.Exists(tempMdbPathName)) throw new IOException("File not found");
IPropertySet propertySet = new PropertySet();
propertySet.SetProperty("CONNECTSTRING",
String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", tempMdbPathName));
workspaceFactory = new OLEDBWorkspaceFactoryClass();
IWorkspace exportWorkspace = workspaceFactory.Open(propertySet, 0);
exportAttributes = null;
attributeDataset = null;
IEnumDataset enumExportDatasets = exportWorkspace.get_Datasets(esriDatasetType.esriDTAny);
while ((attributeDataset = enumExportDatasets.Next()) != null)
{
if (attributeDataset.Name == datasetName)
{
object attributeDatasetObject = attributeDataset.FullName.Open();
exportAttributes = attributeDataset as ITable;
break;
}
}
}
示例7: GetGisServerConnection
private static IAGSServerConnection GetGisServerConnection(Uri uri)
{
var soapUri = AgsUtil.GetSoapRepresentation(uri);
var connectionFactory = (IAGSServerConnectionFactory2) new AGSServerConnectionFactory();
IPropertySet connectionProps = new PropertySet();
connectionProps.SetProperty("URL", soapUri.AbsoluteUri);
return connectionFactory.Open(connectionProps, 0);
}
示例8: OpenSdeWorkspace
/// <summary>
/// Conecta a uma workspace SDE
/// </summary>
private void OpenSdeWorkspace()
{
var factory = new SdeWorkspaceFactoryClass();
IPropertySet set = new PropertySet();
set.SetProperty("server", _server);
set.SetProperty("instance", _instance);
set.SetProperty("user", _user);
set.SetProperty("version", _version);
set.SetProperty("password", _password);
try
{
workspace = factory.Open(set, 0);
isOpened = true;
}
catch (Exception e)
{
isOpened = false;
throw new InvalidOperationException(string.Format("Error to connected in SDE: {0}", e.Message), e);
}
}
示例9: Connect
private IWorkspace Connect(string userName, string password)
{
IPropertySet propertySet = null;
IWorkspaceFactory workspaceFactory = null;
try
{
propertySet = new PropertySet();
propertySet.SetProperty("SERVER", "");
propertySet.SetProperty("INSTANCE", "sde:sqlserver:fmiserver");
propertySet.SetProperty("DATABASE", "sde");
propertySet.SetProperty("VERSION", "SDE.DEFAULT");
propertySet.SetProperty("USER", userName);
propertySet.SetProperty("PASSWORD", password);
workspaceFactory = new SdeWorkspaceFactory();
//propertySet = new PropertySet();
//propertySet.SetProperty("DATABASE", @"C:\Temp\USA.gdb");
//workspaceFactory = new FileGDBWorkspaceFactoryClass();
return workspaceFactory.Open(propertySet, IntPtr.Zero.ToInt32());
}
finally
{
if (workspaceFactory != null)
Marshal.ReleaseComObject(workspaceFactory);
if (propertySet != null)
Marshal.ReleaseComObject(propertySet);
}
}
示例10: Connect
private static IWorkspace Connect()
{
IPropertySet propertySet = null;
IWorkspaceFactory workspaceFactory = null;
try
{
propertySet = new PropertySet();
propertySet.SetProperty(Connection.DATABASE, Connection.DATABASE_PATH);
workspaceFactory = new FileGDBWorkspaceFactoryClass();
return workspaceFactory.Open(propertySet, IntPtr.Zero.ToInt32());
}
catch(Exception e)
{
Console.WriteLine("Error establishing connection to DB. Error: " + e.Message);
}
finally
{
if (workspaceFactory != null)
Marshal.ReleaseComObject(workspaceFactory);
if (propertySet != null)
Marshal.ReleaseComObject(propertySet);
}
return null;
}
示例11: Main
//.........这里部分代码省略.........
IRasterFunction stretchingRGBFunction = new StretchFunction();
// Create an arguments object for the stretch function
IStretchFunctionArguments stretchingRGBFunctionArguments =
new StretchFunctionArgumentsClass();
// Set the type of stretchings to perform
stretchingRGBFunctionArguments.StretchType =
esriRasterStretchType.esriRasterStretchMinimumMaximum;
// Set the statistics created above
stretchingRGBFunctionArguments.Statistics = statsArray;
// Set the extract band function template created above as the input
stretchingRGBFunctionArguments.Raster = extractRgbBandFunctionT;
// Create a Raster Function Template object for the function created above
IRasterFunctionTemplate stretchingRGBFunctionT = new RasterFunctionTemplateClass();
// Set the function on the template
stretchingRGBFunctionT.Function = (IRasterFunction)stretchingRGBFunction;
// Set the arguments for the function
stretchingRGBFunctionT.Arguments = stretchingRGBFunctionArguments;
#endregion
#region Pansharpen the Pan Image with the Multispectral
// Create a Raster Function Arguments object for the pansharpen function
IPansharpeningFunctionArguments pansharpFunctionArguements =
new PansharpeningFunctionArgumentsClass();
// Set the Panchromatic image which has been prepared above
pansharpFunctionArguements.PanImage = stretchingPanFunctionT;
// Set the Multispectral image which has been prepared above
pansharpFunctionArguements.MSImage = stretchingRGBFunctionT;
// Create a new pansharpen raster function object
IRasterFunction pansharpenFunction = new PansharpeningFunction();
// Create a new pansharpen function arguments object
IPansharpeningFunctionArguments pansharpenFunctionArguements =
new PansharpeningFunctionArgumentsClass();
// Set the pansharpening type
pansharpenFunctionArguements.PansharpeningType =
esriPansharpeningType.esriPansharpeningESRI;
// Create an array of doubles that sets the weights for each band
IDoubleArray weightsArray = new DoubleArrayClass();
weightsArray.Add(0.167);
weightsArray.Add(0.166);
weightsArray.Add(0.166);
// and set it on the arguments object
pansharpenFunctionArguements.Weights = weightsArray;
// Create a Raster Function Template object for the pansharpen function
IRasterFunctionTemplate rasterFunction = new RasterFunctionTemplateClass();
rasterFunction.Function = (IRasterFunction)pansharpenFunction;
rasterFunction.Arguments = pansharpFunctionArguements;
((IRasterFunction)rasterFunction).PixelType = rstPixelType.PT_UCHAR;
#endregion
#region Resolve variables
// Create a PropertySet object to set the values for the
// Raster Function Variables created above
IPropertySet variables = new PropertySet();
variables.SetProperty("panImage", panDataset);
variables.SetProperty("rgbImage", rgbDataset);
#endregion
#region Create the Function Raster Dataset
// Create the Function Raster Dataset Object for the Pansharpened Dataset
IFunctionRasterDataset functionRasterDataset = new FunctionRasterDataset();
// Create a name object for the Function Raster Dataset.
IFunctionRasterDatasetName functionRasterDatasetName =
new FunctionRasterDatasetNameClass();
// Specify the output filename for the new dataset (including
// the .afr extension at the end).
functionRasterDatasetName.FullName = outputDataset;
functionRasterDataset.FullName = (IName)functionRasterDatasetName;
// Initialize the new Function Raster Dataset with the Raster Function
// Template and the property set containing the variables and their values.
functionRasterDataset.Init((IRasterFunction)rasterFunction, variables);
ITemporaryDataset myTempDset = (ITemporaryDataset)functionRasterDataset;
myTempDset.MakePermanent();
#endregion
#region Shutdown
Console.WriteLine("Success.");
Console.WriteLine("Press any key...");
Console.ReadKey();
// Shutdown License
aoInit.Shutdown();
#endregion
}
catch (Exception exc)
{
#region Shutdown
Console.WriteLine("Exception Caught while creating Function Raster Dataset. " + exc.Message);
Console.WriteLine("Failed.");
Console.WriteLine("Press any key...");
Console.ReadKey();
// Shutdown License
aoInit.Shutdown();
#endregion
}
}
示例12: addLayerWMS
/// <summary>
/// Adds WMS document to map
/// </summary>
/// <param name="ipMxDoc"></param>
/// <param name="strServer"></param>
/// <param name="strLayerName"></param>
/// <param name="strSecretName"></param>
/// <returns></returns>
private bool addLayerWMS(IMxDocument ipMxDoc, string strServer, string strLayerName, string strSecretName)
{
IPropertySet ipPropSet = new PropertySet();
string strFinalChar;
// check the final char
strFinalChar = strServer.Substring(strServer.Length - 1);
if (strFinalChar == "?" && strFinalChar != "&")
{
if (strServer.Contains("?"))
{
ipPropSet.SetProperty("URL", (strServer + '&'));
}
else
{
ipPropSet.SetProperty("URL", (strServer + '?'));
}
}
else
{
ipPropSet.SetProperty("URL", strServer + '?');
}
IMap map = (IMap)ipMxDoc.FocusMap;
IActiveView activeView = (IActiveView)map;
IWMSGroupLayer wmsGroupLayer = (IWMSGroupLayer)new WMSMapLayerClass();
IWMSConnectionName wmsConnectionName = new WMSConnectionName();
wmsConnectionName.ConnectionProperties = ipPropSet;
IDataLayer dataLayer;
bool connected = false;
try
{
dataLayer = (IDataLayer)wmsGroupLayer;
IName connName = (IName)wmsConnectionName;
connected = dataLayer.Connect(connName);
}
catch (Exception ex)
{
connected = false;
}
if (!connected) return false;
// get service description out of the layer. the service description contains
// information about the wms categories and layers supported by the service
IWMSServiceDescription wmsServiceDesc = wmsGroupLayer.WMSServiceDescription;
IWMSLayerDescription wmsLayerDesc = null;
ILayer newLayer;
ILayer layer;
IWMSLayer newWmsLayer;
IWMSGroupLayer newWmsGroupLayer;
for (int i = 0; i < wmsServiceDesc.LayerDescriptionCount; i++)
{
newLayer = null;
wmsLayerDesc = wmsServiceDesc.get_LayerDescription(i);
if (wmsLayerDesc.LayerDescriptionCount == 0)
{
// wms layer
newWmsLayer = wmsGroupLayer.CreateWMSLayer(wmsLayerDesc);
newLayer = (ILayer)newWmsLayer;
if (newLayer == null) { }
}
else
{
// wms group layer
newWmsGroupLayer = wmsGroupLayer.CreateWMSGroupLayers(wmsLayerDesc);
newLayer = (ILayer)newWmsGroupLayer;
if (newLayer == null) { }
}
// add newly created layer
// wmsGroupLayer.InsertLayer(newLayer, 0);
}
// configure the layer before adding it to the map
layer = (ILayer)wmsGroupLayer;
layer.Name = wmsServiceDesc.WMSTitle;
// add to focus map
map.AddLayer(layer);
// add to the service list
string strItem = EncodeServiceList(strServer, wmsServiceDesc.WMSTitle, strSecretName);
// m_pLogger.Msg "adding to service list : " & strItem
colServiceList.Add(strItem);
// set flag
return true;
}