本文整理汇总了C#中Geoprocessor.GetMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Geoprocessor.GetMessage方法的具体用法?C# Geoprocessor.GetMessage怎么用?C# Geoprocessor.GetMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geoprocessor
的用法示例。
在下文中一共展示了Geoprocessor.GetMessage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FieldCal
//执行计算,输出计算结果信息字符串
private string FieldCal(IFeatureLayer pFtLayer, string strExpression)
{
txtMessage.Text = "正在计算请稍后……\r\n";
try
{
Geoprocessor Gp = new Geoprocessor();
Gp.OverwriteOutput = true;
CalculateField calField = new CalculateField();
calField.expression = strExpression;
Gp.Execute(calField, null);
for (int i = 0; i < Gp.MessageCount; i++)
{
txtMessage.Text += Gp.GetMessage(i).ToString() + "\r\n";
}
return "计算成功";
}
catch (Exception e)
{
txtMessage.Text += e.Message;
return "计算失败" + e.Message;
}
}
示例2: ReturnMessages
protected virtual void ReturnMessages(Geoprocessor gp)
{
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
Console.WriteLine(gp.GetMessage(Count));
}
}
}
示例3: GetMessages2
/// <summary>
/// 输出地理处理的过程信息
/// </summary>
/// <param name="gp"></param>
/// <returns></returns>
public static string GetMessages2(Geoprocessor gp)
{
StringBuilder msgBuilder = new StringBuilder();
if (gp != null)
{
for (int i = 0; i < gp.MessageCount; i++)
{
msgBuilder.Append(gp.GetMessage(i));
msgBuilder.Append(" ");
}
}
return msgBuilder.ToString();
}
示例4: ReturnMessages
//GP message handling
private static void ReturnMessages(Geoprocessor gp)
{
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
System.Console.WriteLine(gp.GetMessage(Count));
}
}
}
示例5: ReturnMessages
// Function for returning the tool messages.
private static void ReturnMessages(Geoprocessor gp)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += gp.GetMessage(Count);
}
}
}
示例6: ReturnMessages
// Function for returning the tool messages.
private static bool ReturnMessages(Geoprocessor gp)
{
bool theReturn = true;
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
string msg = gp.GetMessage(Count);
if (msg.Contains("Failed to execute"))
theReturn = false;
Debug.WriteLine(msg);
}
}
return theReturn;
}
示例7: ExportPages
//.........这里部分代码省略.........
//worldfile扩展名
string worldfileExt = "." + sExt[1].ToString() + sExt[sExt.Length - 1].ToString() + "w";
#endregion
#region 分页输出
int index = 0;
int minX = 0, maxY = iHeight;
double w, h = 0;
string t_name = subPath + @"\" + NameNoExt + "_";
IExport docExport = CreateExport(filename, 1);
IEnvelope pEnv1 = new EnvelopeClass();
while (h < height - 0.0001)
{
w = 0;
minX = 0;
while (w < width - 0.0001)
{
pEnv1.XMin = w;
pEnv1.YMin = h;
pEnv1.XMax = w + paperWidth;
pEnv1.YMax = h + paperHeight;
index++;
label1.Text += ".";
Application.DoEvents();
//output输出
ActiveViewOutput(docActiveView, iDPI, iWidth, iHeight, pEnv1, t_name + index.ToString() + sExt, docExport);
//写入worldfile
WriteWorldfile(t_name + index.ToString() + worldfileExt, 1, 0, 0, -1, minX, maxY);
w += paperWidth;
minX += iWidth;
}
h += paperHeight;
maxY += iHeight;
}
#endregion
#region 合并栅格
//设置坐标参考
var pRasterWS = OpenWorkspace(subPath, enumWsFactoryType.Raster);
ISpatialReferenceFactory2 pSrF = new SpatialReferenceEnvironmentClass();
var pSR = pSrF.CreateSpatialReference(3857);
var pEnumDS = pRasterWS.get_Datasets(esriDatasetType.esriDTRasterDataset);
var pDS = pEnumDS.Next();
while (pDS != null)
{
var GeoSchEdit = pDS as IGeoDatasetSchemaEdit;
if (GeoSchEdit.CanAlterSpatialReference)
GeoSchEdit.AlterSpatialReference(pSR);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(pDS);
pDS = pEnumDS.Next();
}
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(pRasterWS);
//saveas时占用很大内存且不释放,使用GP工具
//怎么不创建金字塔和头文件??
Geoprocessor geoprocessor = new Geoprocessor();
try
{
CreateRasterDataset createRD = new CreateRasterDataset();
createRD.cellsize = 1;
createRD.number_of_bands = 3;
createRD.out_path = filepath;
createRD.out_name = NameExt;
createRD.pyramids = "NONE";
createRD.compression = "NONE";
geoprocessor.Execute(createRD, null);
WorkspaceToRasterDataset MosaicToRaster = new WorkspaceToRasterDataset();
MosaicToRaster.in_workspace = subPath;
MosaicToRaster.in_raster_dataset = filename;
geoprocessor.Execute(MosaicToRaster, null);
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
for (int i = 0; i < geoprocessor.MessageCount; i++)
{
string abc = geoprocessor.GetMessage(i);
Console.WriteLine(abc);
}
}
#endregion
return subPath;
}
else
{
Export10Plus(docActiveView, filename, iDPI, 0, 0, null);
return "";
}
}
else //map
{
return "";
}
}
示例8: CriarShapefile
/// <summary>
/// Cria um shapefile a partir de um featureCursor
/// </summary>
/// <param name="feature">Feature desejada</param>
public static void CriarShapefile(IFeatureLayer fLayer,
IFeature feature,
string pasta,
IActiveView activeView,
bool adicionarSaidaNoMapa,
IFeatureWorkspace pFeatureWorkspaceShp)
{
if (feature != null)
{
#region Deletando shapefiles que possam existir já no diretório
DirectoryInfo dirInf = new DirectoryInfo(pasta);
FileInfo[] fi = dirInf.GetFiles();
for (int i = 0; i < fi.Length; i++)
{
if (fi[i].Name.Contains(fLayer.FeatureClass.AliasName) && !fi[i].Name.Contains(".lock"))
{
fi[i].Delete();
}
}
#endregion
IWorkspace pScratchWorkspace;
IScratchWorkspaceFactory pScratchWorkspaceFactory;
pScratchWorkspaceFactory = new ScratchWorkspaceFactoryClass();
pScratchWorkspace = pScratchWorkspaceFactory.DefaultScratchWorkspace;
IFeatureSelection pNewSelSet = fLayer as IFeatureSelection;
IEnvelope pEnv = activeView.Extent.Envelope;
IGeometry pEnvGeo = pEnv as IEnvelope;
ISpatialFilter pSF = new SpatialFilterClass();
pSF.Geometry = pEnvGeo;
pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
IQueryFilter qf = new QueryFilterClass();
qf.WhereClause = (fLayer as IFeatureLayerDefinition).DefinitionExpression;
pNewSelSet.SelectFeatures(qf, esriSelectionResultEnum.esriSelectionResultNew, false);
Geoprocessor gp = new Geoprocessor();
gp.AddOutputsToMap = adicionarSaidaNoMapa;
FeatureClassToShapefile fcToShapeFile = new FeatureClassToShapefile();
fcToShapeFile.Input_Features = fLayer;
fcToShapeFile.Output_Folder = pasta;
IGeoProcessorResult result = gp.Execute(fcToShapeFile, null) as IGeoProcessorResult;
string nomeArquivoSaida = gp.GetMessage(3);
IFeatureClass pFeatureClassShp = pFeatureWorkspaceShp.OpenFeatureClass(fLayer.FeatureClass.AliasName);
GisUtils.TratarSubtiposDominiosShapefile(fLayer, pasta, pFeatureWorkspaceShp, pFeatureClassShp);
pFeatureClassShp = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
示例9: ReturnMessages
private string ReturnMessages(Geoprocessor gp)
{
StringBuilder sb = new StringBuilder();
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
System.Diagnostics.Trace.WriteLine(gp.GetMessage(Count));
sb.AppendFormat("{0}\n", gp.GetMessage(Count));
}
}
return sb.ToString();
}
示例10: ReturnMessages
private static string ReturnMessages(Geoprocessor gp)
{
string msgRet = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
msgRet += gp.GetMessage(Count);
}
}
return msgRet;
}