Professional Documents
Culture Documents
ESRI
2011 9
ESRI
/
V0.1 2011.3.4
V0.2 2011.4.8
V0.3 2011.5.18
V0.4 2011.6.25
V0.5 2011.7.18
V0.6 201.8.26
V0.7 2011.9.3
1 . ArcGIS .................................................................................................. 2
3 ........................................................ 22
4 ................................................................................................ 71
5 .............................................................................. 121
6 .................................................................................. 154
7 ...................................................................................................... 169
8 .......................................................................................... 202
9 .......................................................................................................... 237
10 .................................................................................................. 260
12 . ................................................................................................. 303
1 . ArcGIS
1.1 ArcGIS
GIS
GIS
ArcGIS Server
Internet ArcSDE
ArcGIS Engine
RuntimeArcGIS Engine
GIS Windows
ArcObjects ArcGISEngine
ArcGIS Engine
C COM .NET
ArcGIS Engine
ArcGIS Engine
Base Services
Data Access
GeoDatabase
Map Presentation
GIS
Develper Components
M apControlPageLayoutControlSceneControl
GlobeControlTOCControlToolbarControlSymbologyControl LicensenControl
Extensions
GeoDatabase UpdateSchematics
License
ArcGIS Engine
bin dll ,
Version
, Engine
System
ArcGIS
SystemUI
IToolControl UI utility
ArcGIS
Geometry
Segment segments
Buffer ClipGIS
Geometry
Display
Display GIS
M ap PageLayout
(display feedbacks)
Output
Output (enhanced
metafiles)(JPGBMP ) ArcGIS
GeoDatabase
ArcGIS
GeoDatabase geodatabase
(FeaturesClasses ) PlugInDataSource
geodatabase native
DataSourcesFile
DataSourcesGDB
DataSourceOleDB
DataSourcesOleDB
DataSourceRaster
RDBM Ss RDO
RDO DataSourcesRaste
GeoDatabaseDistributed
GeoDatabaseDistributed
Carto
Carto
PageLayout ()M ap
M ap
Renderer
renderer M ap PageLayout
(elements)
Carto
Location
GeocodeServer API
NetworkAnalysis
Controls
M ap PageLayout TOCControl
ToolbarControl
GeoAnalyst
3D Analyst
3DAnalyst
3DAnalyst Carto
(scene)
3DAnalyst Controls
3D Analyst
GlobeCore
Globe M ap GlobeCamera
dll
2 ArcGIS Engine C#
2.1
ArcGIS Engine
. IPeople
using System;
using System.Collections.Generic;
using System.Text;
namespace InterfaceTest
{
interface IPeople
{
void gender();
}
}
gender gender
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InterfaceTest
{
class Boy:IPeople
{
public void gender()
{
Console.WriteLine("Im a boy.");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InterfaceTest
{
class Girl:IPeople
{
public void gender()
{
Console.WriteLine("Im a girl.");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InterfaceTest
{
class Program
{
static void Main(string[] args)
{
IPeople Person; //
Person = new Boy(); //
Person.gender(); // Boy gender
Person = new Girl(); //
Person.gender(); // Gril gender
Console.ReadLine();
}
}
}
2.1.1 C#
2.1.2 OMD
ArcGIS Engine
UM L UM L
Visual Basic
ArcInfo
pdf ArcObjects,
1.
OM D
OM D 3D
C# New OM D 3D
2.
association Multiplicity
1 1
0..1
M ..N M N
*0 *
1 *
type inheritance
Instantiation
pole transformer
Aggregation
Composition
Crossarm
OM D
Read write
ArcGIS Engline
(Typelnheritance) (Querylnterface)
(Interfacelnheritance)
1.1
,ArcObjcets class,
AbstractClassCoClassClass
FeatureLayerClass IFeatureLayer
Java.
1.3 (QueryInterface)
, Dim pM ap as IM ap Set
pM ap = New M ap pM ap.Clear pM ap IM ap
IActiveView
QueryInterface(QI):
1.4
OpenFromFileShpfileWorkspaceFactry OpenFromFile
AccessWorkspaceFactry OpenFromFilemdb
2.2 QI
2.2.1 C#+QI
COM
COM /
COM
QI QI
COM
Query Interface
QI
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QITest
interface IFavoriteFood
void Food();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QITest
interface IVoice
void Voice();
Cat
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QITest
Console.WriteLine(".");
Console.WriteLine(",,...");
Cat
,,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QITest
class Program
pVoice.Voice();//IVoice
// pVoice.Food(); IVoice
pFavoriteFood.Food();//IFavoriteFood
Console.ReadLine();
1 Windows (------Windos )
2 VS ArcGIS Engine
,VS
4)Map --
7)
Toolbar control items
ArcGIS 10
AO
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine);
Main
COM
3.1 Mxd
OpenMXD.Title = "";
OpenMXD.InitialDirectory = "E:";
if (OpenMXD.ShowDialog() == DialogResult.OK)
{
axMapControl1.LoadMxFile(MxdPath);
LoadMxFile
OpenMXD.Title = "";
OpenMXD.InitialDirectory = "E:";
if (OpenMXD.ShowDialog() == DialogResult.OK)
{
MxdPath = OpenMXD.FileName;
return MxdPath;
}
3.2 Shape
AxMapControl
AddShapeFile
shp shp
OpenShpFile.Title = "Shape";
OpenShpFile.InitialDirectory = "E:";
OpenShpFile.Filter = "Shape(*.shp)|*.shp";
if (OpenShpFile.ShowDialog() == DialogResult.OK)
{
ShpFile[0] = FilePath;
ShpFile[1] = ShpName;
return ShpFile;
3.3
M apControl PageLayoutControl
PageLayout
buddy M apControl
PageLayoutControSceneControl globeControl
if (pMapDocument.get_IsMapDocument(path))
pMapDocument.Open(path, null);
IMap pMap;
pMap = pMapDocument.get_Map(i);
Console.WriteLine(pMap.Name);
pEnumLayer.Reset();
Console.WriteLine(pLayer.Name);
pLayer = pEnumLayer.Next();
3.3.1 MapControl
M apControl ArcM ap M ap
M apControl M xd Shp
M apControl
COM COM
, , Interface
, , ,
, , ,
, , ,
InBound Interface, ,
, , , OutBound interface,
, COM
, , , ,
, OnM ouseUp
3.3.1.2
axM apControl1
axM apControl2
axToolbarControl1
axTOCControl1
axM apControl1
OnM apReplaced
//axMapControl2
pGraphicsContainer.DeleteAllElements();
pElement.Geometry = pEnvelope;
//
pColor.Red = 255;
pColor.Green = 0;
pColor.Blue = 0;
pColor.Transparency = 255;
//
pOutline.Width = 3;
pOutline.Color = pColor;
//
pColor.Red = 255;
pColor.Green = 0;
pColor.Blue = 0;
pColor.Transparency = 0;
//
pFillSymbol.Color = pColor;
pFillSymbol.Outline = pOutline;
pFillShapeEle.Symbol = pFillSymbol;
pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0);
if (axMapControl1.LayerCount > 0)
{
axMapControl2.Map = new MapClass();
axMapControl2.Refresh();
OnMouseDown
if (e.button == 1)
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.mapX, e.mapY);
axMapControl1.CenterAt(pPoint);
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,
null, null);
pPoint.PutCoords(e.mapX, e.mapY);
axMapControl1.CenterAt(pPoint);
axMapControl1.Extent = pEnv;
}
}
3.3.2 TOCContro
TOCControl
TOCControl TOCControl
3.3.2.1
Form
if (axMapControl1.LayerCount > 0)
{
esriTOCControlItem pItem = new esriTOCControlItem();
if (e.button == 2)
{
context.Show(axTOCControl1, e.x, e.y);
}
Click
Ft.Show();
GridView
IFields pFields;
pFields = pFeatureLayer.FeatureClass.Fields;
dtGridView.ColumnCount = pFields.FieldCount;
for (int i = 0; i < pFields.FieldCount;i++ )
{
dtGridView.Columns[i].ValueType =
System.Type.GetType(ParseFieldType(pFields.get_Field(i).Type));
}
IFeatureCursor pFeatureCursor;
IFeature pFeature;
pFeature = pFeatureCursor.NextFeature();
while (pFeature != null)
{
string[] fldValue = new string[pFields.FieldCount];
3.3.3 ToolBarControl
ToolBarControl ToolBarControl
ToolBarControl
ToolBarControl
12
CurrentTool
ToolBarControl
()
3.3.3.1
ICommand
ICommand.OnClick
ToolBarControl
UID
progID
IComma nd
pUID.Value = "esriControls.ControlsUndoCommand";
esriCommandStyles.esriCommandStyleIconOnly);
esriCommandStyles.esriCommandStyleIconOnly);
ICommand ICommand
Esri
ToolBarControl ToolBarControl
ICommand ICommand.OnCreate
hook
[C #]
p ub lic void O n C r e a t e (
object hook
);
ToolBarControl ICommand.OnCreate
hook hook
M apControl
PageLayoutControl TOCContro
, Esri
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Carto;
using System.Windows.Forms;
namespace EngineApplication
{
/// <summary>
/// Summary description for OpenMxdCommand.
/// </summary>
[Guid("c142fea5-2e8e-4f68-95e1-9cad4a6a290e")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("CalculateContourTask.OpenMxdCommand")]
public sealed class OpenMxdCommand : BaseCommand
{
#region COM Registration Function(s)
[ComRegisterFunction()]
[ComVisible(false)]
static void RegisterFunction(Type registerType)
{
// Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType);
//
// TODO: Add any COM registration code here
//
}
[ComUnregisterFunction()]
[ComVisible(false)]
static void UnregisterFunction(Type registerType)
{
// Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType);
//
// TODO: Add any COM unregistration code here
//
}
/// <summary>
/// Required method for ArcGIS Component Category registration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryRegistration(Type registerType)
{
string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}",
registerType.GUID);
ControlsCommands.Register(regKey);
}
/// <summary>
/// Required method for ArcGIS Component Category unregistration -
/// Do not modify the contents of this method with the code editor.
/// </summary>
private static void ArcGISCategoryUnregistration(Type registerType)
{
string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}",
registerType.GUID);
ControlsCommands.Unregister(regKey);
#endregion
#endregion
IMapControl2 pMapControl;
public OpenMxdCommand()
{
//
// TODO: Define values for the public properties
//
base.m_category = ""; //localizable text
base.m_caption = ""; //localizable text
base.m_message = ""; //localizable text
base.m_toolTip = ""; //localizable text
base.m_name = " "; //unique id, non-localizable (e.g.
"MyCategory_MyCommand")
try
{
//
/// <summary>
/// Occurs when this command is created
/// </summary>
/// <param name="hook">Instance of the application</param>
public override void OnCreate(object hook)
{
if (hook == null)
return;
//hook
if (hook is IToolbarControl)
{
IToolbarControl pToolBar= hook as IToolbarControl ;
pMapControl = pToolBar.Buddy as IMapControl2;
}
else if(hook is IMapControl2 )
{
pMapControl = hook as IMapControl2;
}
/// <summary>
/// Occurs when this command is clicked
/// </summary>
public override void OnClick()
{
// TODO: Add OpenMxdCommand.OnClick implementation
pMapControl.ActiveView.Refresh();
pMapDoc.Close();
}
}
}
#endregion
}
}
ToolBarControl
esriCommandStyles.esriCommandStyleIconOnly);
axToolbarControl1.AddItem(pMxdCommand, -1, 0,
if (hook is IToolbarControl)
{
IToolbarControl pToolBar= hook as IToolbarControl ;
pMapControl = pToolBar.Buddy as IMapControl2;
}
ToolbarControl
ITool .
ToolBarControl ToolBarControl
3.3.4 ToolBarControl
Form MenueStrip
pMxd.OnCreate(axMapControl1.Object);
pMxd.OnClick();
}
pAddData.OnCreate(axMapControl1.Object);
pAddData.OnClick();
}
pZoomIn.OnCreate(axMapControl1.Object);
pZoomOut.OnCreate(axMapControl1.Object);
toolbarcontrol
3.3.5 PageLayoutControl
ArcM ap M apControl
PageLayout
ArcMap
M apControl PageLayout
PageLayout M apControl
TOC ToolBar
Form TabControl
NET ControlsSynchronizer
/// <summary>
///
/// </summary>
/// <param name="_MapControl"></param>
/// <param name="_PageLayoutControl"></param>
public ControlsSynchronizer(IMapControl3 _MapControl, IPageLayoutControl2
_PageLayoutControl)
: this()
{
//assign the class members
pMapControl = _MapControl;
pPageLayoutControl = _PageLayoutControl;
/// <summary>
///
/// </summary>
public void ActivateMap()
{
try
{
if (pPageLayoutControl == null || pMapControl == null)
throw new Exception("ControlsSynchronizer::ActivateMap:\r\nEither MapControl or
PageLayoutControl are not initialized!");
//assign the last active tool that has been used on the MapControl back as the active
tool
if (pMapActiveTool != null) pMapControl.CurrentTool = pMapActiveTool;
pIsMapControlactive = true;
//on each of the framework controls, set the Buddy control to the MapControl
this.SetBuddies(pMapControl.Object);
}
catch (Exception ex)
{
throw new Exception(string.Format("ControlsSynchronizer::ActivateMap:\r\n{0}",
ex.Message));
}
/// <summary>
///
/// </summary>
public void ActivatePageLayout()
{
try
{
if (pPageLayoutControl == null || pMapControl == null)
throw new Exception("ControlsSynchronizer::ActivatePageLayout:\r\nEither MapControl
or PageLayoutControl are not initialized!");
//assign the last active tool that has been used on the PageLayoutControl back as the
active tool
if (pPageLayoutActiveTool != null) pPageLayoutControl.CurrentTool =
pPageLayoutActiveTool;
pIsMapControlactive = false;
//on each of the framework controls, set the Buddy control to the PageLayoutControl
this.SetBuddies(pPageLayoutControl.Object);
}
catch (Exception ex)
{
throw new Exception(string.Format("ControlsSynchronizer::ActivatePageLayout:\r\n{0}",
ex.Message));
}
/// <summary>
/// IToolbarControlITOCControl
/// </summary>
/// <param name="buddy">the active control</param>
private void SetBuddies(object _buddy)
{
try
{
if (_buddy == null)
throw new Exception("ControlsSynchronizer::SetBuddies:\r\nTarget Buddy Control is not
initialized!");
/// <summary>
///
/// </summary>
/// <param name="_NewMap"></param>
public void ReplaceMap(IMap _NewMap)
{
if (_NewMap == null)
throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nNew map for replacement is
not initialized!");
//call replace map on the PageLayout in order to replace the focus map
//we must call ActivatePageLayout, since it is the control we call 'ReplaceMaps'
this.ActivatePageLayout();
pPageLayoutControl.PageLayout.ReplaceMaps(pMaps);
pPageLayoutControl.ActiveView.Refresh();
}
/// <summary>
///
/// </summary>
/// <param name="activateMapFirst">true if the MapControl supposed to be activated
first</param>
public void BindControls(bool _ActivateMapFirst)
{
if (pPageLayoutControl == null || pMapControl == null)
throw new Exception("ControlsSynchronizer::BindControls:\r\nEither MapControl or
PageLayoutControl are not initialized!");
//
IMap pNewMap = new MapClass();
pNewMap.Name = "Map";
//Maps
IMaps pMaps = new Maps();
//add the new Map instance to the Maps collection
pMaps.Add(pNewMap);
//call replace map on the PageLayout in order to replace the focus map
pPageLayoutControl.PageLayout.ReplaceMaps(pMaps);
//assign the new map to the MapControl
pMapControl.Map = pNewMap;
pMapActiveTool = null;
M ap OnClick map
{
//launch a new OpenFile dialog
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Map Documents (*.mxd)|*.mxd";
dlg.Multiselect = false;
dlg.Title = "Open Map Document";
if (dlg.ShowDialog() == DialogResult.OK)
{
string docName = dlg.FileName;
pControlsSynchronizer.PageLayoutControl.PageLayout = pMapDoc.PageLayout;
pControlsSynchronizer.ReplaceMap(map);
pMapDoc.Close();
m_sDocumentPath = docName;
}
}
ControlsSynchronizerMaps
namespace EngineApplication
{
/// <summary>
/// Implementation of interface IMaps which is eventually a collection of Maps
/// </summary>
public class Maps : IMaps, IDisposable
{
//class member - using internally an ArrayList to manage the Maps collection
private ArrayList pArray = null;
/// <summary>
/// Dispose the collection
/// </summary>
public void Dispose()
{
if (pArray != null)
{
pArray.Clear();
pArray = null;
}
}
#endregion
/// <summary>
/// Remove the Map at the given index
/// </summary>
/// <param name="Index"></param>
public void RemoveAt(int Index)
{
if (Index > pArray.Count || Index < 0)
throw new Exception("Maps::RemoveAt:\r\nIndex is out of range!");
pArray.RemoveAt(Index);
}
/// <summary>
/// Reset the Maps array
/// </summary>
public void Reset()
{
pArray.Clear();
}
/// <summary>
/// Get the number of Maps in the collection
/// </summary>
public int Count
{
get
{
return pArray.Count;
}
}
/// <summary>
/// Remove the instance of the given Map
/// </summary>
/// <param name="Map"></param>
public void Remove(IMap Map)
{
pArray.Remove(Map);
}
/// <summary>
/// Create a new Map, add it to the collection and return it to the caller
/// </summary>
/// <returns></returns>
public IMap Create()
{
return newMap;
}
/// <summary>
/// Add the given Map to the collection
/// </summary>
/// <param name="Map"></param>
public void Add(IMap Map)
{
if (Map == null)
throw new Exception("Maps::Add:\r\nNew Map is mot initialized!");
pArray.Add(Map);
}
#endregion
}
}
3.3.5.2 Map
, ArcMap
ArcMap
Map
ArcMap Map
GIS
Shp Map
geomtry
Map
3.3.5.3 IMap
Map
IMap IMap
Map
IMap IMap
IMap.SelectByShape IMap.SelectFeature
IMap.SelectFeature Map
IMap.SelectByShape
[C #]
p ub lic void S e l e c t B y S h a p e (
IGeometry Shape,
ISelectionEnvironment env,
bool justOne
);
IMap.SelectByShape Map
Geomtry
IMap.SelectByShape
Selectable true
ISelectionEnvironmentISelectionEnvironment
bool
MapC ontrol
axMapControl1.ActiveView.Refresh();
IMap.SelectFeature
[C #]
p ub lic void S e l e c t F e a t u r e (
ILayer Layer,
IFeature Feature
);
{
IFeatureCursor pFtCursor = _pFeatureLayer.Search(_pQuery, _Bool);
pFt = pFtCursor.NextFeature();
3.3.5.4 IGraphicsContainer
Map Map
Map IGraphicsContainer
3.3.5.5 IActiveView
IActiveView Map
ArcMap
ArcGIS Engine
Map PageLayout
IActiveView PartialRefresh
3.3.5.6 ILayer
ILayer Layer
IFeatureLayerIGeoFeatureLayer
ICadFeatureLayerIRasterLayer
ArcMap
3.3.5.7 IFeatureLayer
IFeatureLayer Featureclass
IFeatureLayer IFeatureLayer.Search
3.3.5.8 IGeoFeaturelayer
IGeoFeatureLayer
IGeoFeatureLayer.Renderer
4.1
4.1.1 Geodatabase
SDE
ACCESS windows
2GB, 1TB,
256TB,
linuxunix Sde
SDE
Geodatabase
Geodatabase (
)()
4.1.2 Geodatabase
(Feature dataset)
Geodatabase TIN
OM D
4.2 IWorkSpace
IWorkspace
4.3
WorkspaceFactory
WorkspaceFactory
OM D
shapefile Esri
shapefile workspace
shapefile shapefileworkspacefactory
Engine
OpenFromFile Open
4.3.1
return pWs;
}
4.3.2
return pWs;
4.3.3 SDE
Key-Value Open
4.4
4.4.1
Geodatabase Dataset
Workspace
IFeatureWorkspace.OpenFeatureClass
Windows
TableFeatureClass
Workspace
IDataset
IDataset
IDataset.TypeIDataset.Type
4.4.2
ArcGIS Engine
string WsFileName="";
OpenFile.Filter = "(MDB)|*.mdb";
if (DialogR == DialogResult.Cancel)
{
}
else
{
WsFileName = OpenFile.FileName;
}
return WsFileName;
if (WsName != "")
{
{
IEnumDataset pESubDataset = pDataset.Subsets;
pSubDataset = pESubDataset.Next();
}
}
pDataset = pEDataset.Next();
}
FeatureClassBox.Text = FeatureClassBox.Items[0].ToString();
}
4.4.3
IDatasetEdit.IsBeingEdited
4.5
4.5.1.1 IName
Table Table
Geodataset Fullname
Open
QI
IName IName
IWorkspaceName.open. IName
IName IWorkspaceName
IWorkspaceName
IWorkspaceName.WorkspaceFactoryProgID
esriDataSourcesGDB.AccessWorkspaceFactory
esriDataSourcesFile.ArcInfoWorkspaceFactory
esriDataSourcesFile.C adWorkspaceFactory
esriDataSourcesGDB.FileGDBWorkspaceFactory
esriDataSourcesOleDB.OLEDBWorkspaceFactory
esriDataSourcesFile.PC C overageWorkspaceFactory
esriDataSourcesRaster.RasterWorkspaceFa ctory
esriDataSourcesGDB.SdeWorkspaceFactory
esriDataSourcesFile.ShapefileWorkspaceFactory
esriDataSourcesOleDB.TextFileWorkspaceFactory
esriDataSourcesFile.TinWorkspaceFactory
esriDataSourcesFile.VpfWorkspaceFactory
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory";
pWorkspaceName.PathName = _pWorkspacePath;
return pWorkspace;
WorkSpace
IWorkSpaceIFeatureWorkspace
4.6
IFeatureWorkspace
4.6.1 IFeatureWorkspace
OpenDatasetOpenTableOpenFeatureClass
PointTest OpenFeatureClass
ArcMap Catalog
FeatureClas Dataset
pDatset.Delete();
4.7
IFeatureWorkspace.CreateFeatureClass
4.7.1 IFieldIFieldEditIFieldsIFieldsEditIGeometryDef
IGeometryDefEdit
GeometryDef
, Catalog
Point
6 Edit
GeometryDef
NET _2
//
ISpatialReference pSpatialReference =
axMapControl1.ActiveView.FocusMap.SpatialReference;
//
IFields pFields = new FieldsClass();
IFieldsEdit pFieldsEdit = (IFieldsEdit)pFields;
//
IField pField = new FieldClass();
IFieldEdit pFieldEdit = (IFieldEdit)pField;
pFieldEdit.Name_2 = "SHAPE";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
pFieldsEdit.AddField(pField);
pFieldEdit.GeometryDef_2 = pGeoDef;
//
pField = new FieldClass();
pFieldEdit = (IFieldEdit)pField;
pFieldEdit.Name_2 = "STCD";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
pFieldsEdit.AddField(pField);
//
pField = new FieldClass();
pFieldEdit = (IFieldEdit)pField;
pFieldEdit.Name_2 = "SLM10";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
pFieldsEdit.AddField(pField);
//
pField = new FieldClass();
pFieldEdit = (IFieldEdit)pField;
pFieldEdit.Name_2 = "SLM20";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
pFieldsEdit.AddField(pField);
//
pField = new FieldClass();
pFieldEdit = (IFieldEdit)pField;
pFieldEdit.Name_2 = "SLM40";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
pFieldsEdit.AddField(pField);
4.8
//
ISchemaLock pSchemaLock = (ISchemaLock)pTable;
pSchemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
if (pTable.FindField(pOriFieldName) != -1)
{
pClassSchemaEdit.AlterFieldAliasName(pOriFieldName, pDesFieldName);
pSchemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
}
else
{
return;
}
}
pCodedValueDomain.AddCode("RES", "Residential");
pCodedValueDomain.AddCode("COM", "Commercial");
pCodedValueDomain.AddCode("IND", "Industrial");
pWorkspaceDomains.AddDomain(pDomain);
}
IDomain pDistributionDiamDomain =
pWorkspaceDomains.get_DomainByName("DistDiam");
pSubtypes.SubtypeFieldName = "PipeType";
pSubtypes.AddSubtype(1, "Primary");
pSubtypes.AddSubtype(2, "Secondary");
pSubtypes.DefaultSubtypeCode = 1;
}
4.9
4.9.1
Esri ArcGIS 10
IM G
ArcSDE
ArcSDE
2
1 (GB) DBMS
TB
Mosaic Mosaic
4.9.2
, FeatureClass ,,
IFeatureWorkspace, IRasterWorkspace,:
try
{
IWorkspaceFactory pWorkFact = new RasterWorkspaceFactoryClass();
return pWorkFact.OpenFromFile(pWsName, 0) as IRasterWorkspace;
}
catch (Exception ex)
{
return null;
}
SDE ,, IRasterWorkspaceEx
IRasterWorkspace IRasterWorkspaceEx
1) IRasterWorkspace
2) IRasteWorkspaceEx GeoDatabase ,:
4.9.3
4.9.4
IRasterBandCollection pRasterBands =
(IRasterBandCollection)pRasterDataset;
pRasterProps.NoDataValue = 255;
do
{
IPixelBlock3 pPixelblock = pRasterCursor.PixelBlock as IPixelBlock3;
pPixelblock.set_PixelData(0, (System.Array)pixels);
pRasterEdit.Write(pUpperLeft, (IPixelBlock)pPixelblock);
} while (pRasterCursor.Next());
System.Runtime.InteropServices.Marshal.ReleaseComObject(pRasterEdit);
return pRasterDataset;
4.9.5
IMosaicWorkspaceExtension pMosaicExtention =
pMosaicExentionHelper.FindExtension(pFgdbWorkspace);
return pMosaicExtention.OpenMosaicDataset(pMDame);
4.9.6
/// <summary>
///
/// </summary>
/// <param name="pFGDBPath"></param>
/// <param name="pMDame"></param>
/// <param name="pSrs"></param>
/// <returns></returns>
IMosaicDataset CreateMosaicDataset(string pFGDBPath, string pMDame,
ISpatialReference pSrs )
{
pCreationPars.BandCount = 3;
pCreationPars.PixelType = rstPixelType.PT_UCHAR;
IMosaicWorkspaceExtension pMosaicExtention =
pMosaicExentionHelper.FindExtension(pFgdbWorkspace);
4.10
GIS GIS
4.10.1 Table
IRowITable
Source
4.10.2
Table
Table Object
4.10.3 FeatureClass
Feature
Feature
IFeatureClass.Search IFeatureClass.Select
Search
true
false
IFeatureCursor pFtCursor;
if (_Bool == false)
{
pFtCursor = _pFeatureClass.Search(null, _Bool);
pFt1 = pFtCursor.NextFeature();
if (pFt1 == pFt2)
{
MessageBox.Show("Recycling false");
}
pFt1 = pFtCursor.NextFeature();
}
}
else
{
pFtCursor = _pFeatureClass.Search(null, _Bool);
pFt1 = pFtCursor.NextFeature();
if (pFt1 == pFt2)
{
MessageBox.Show("Recycling true");
}
pFt1 = pFtCursor.NextFeature();
}
}
false ,
Search Select
OID
4.10.3.3Cursor FeatureCursor
Cursor
ITable.Search
GIS ICursor
IFeatureCursor
4.10.3.4QueryFilter SpatialFilter
ArcGIS Engine
QueryFilter SpatialFilter
ArcGIS Engine
4.10.4 IFeatureSelection
4.10.4.1 IFeatureSelection
IFeatureSelection
pFeatureSelection.SelectFeatures(pQuery,esriSelectionResultEnum.esriSelectionResultNew,false
);
axMapControl1.ActiveView.Refresh();
GetLayer
pRetureLayer = pEnunLayer.Next();
}
return pRetureLayer;
}
4.10.5
public ESRI.ArcGIS.Geodatabase.IFeatureCursor
GetAllFeaturesFromPointSearchInGeoFeatureLayer(ESRI.ArcGIS.Geometry.IEnvelope pEnvelope,
IPoint pPoint, IFeatureClass pFeatureClass)
{
ESRI.ArcGIS.Geodatabase.IFeatureCursor pFeatureCursor =
pFeatureClass.Search(pSpatialFilter, false);
return pFeatureCursor;
IEnumFeatureSetup pEnumFeatureSetup =
(IEnumFeatureSetup)selection;
pEnumFeatureSetup.AllFie lds=true;
string a =
Convert.ToString(feature.get_Value(feature.Fie lds.FindField("dfd")));
feature = pEnumFeature.Next();
4.11
ArcGIS 10 ArcGIS 10
PDF
HTML
4.11.1
ITableAttachments
FeatureClass
IAttachmentManager
IAttachment
IMemoryBlobStream
ArcGIS ,
if (pTableAtt.HasAttachments == false)
{
pTableAtt.AddAttachments();
}
//
IAttachmentManager pAttachmentManager = pTableAtt.AttachmentManager;
//
IMemoryBlobStream pMemoryBlobStream = new MemoryBlobStreamClass();
pMemoryBlobStream.LoadFromFile(pFilePath);
//
IAttachment pAttachment = new AttachmentClass();
pAttachment.ContentType=pFileType;
pAttachment.Name = System.IO.Path.GetFileName(pFilePath);
pAttachment.Data = pMemoryBlobStream;
//
pAttachmentManager.AddAttachment(pID, pAttachment);
4.12 Table
/// <summary>
/// 3IDFID
///
/// </summary>
/// <param name="_TablePath "></param>
/// <param name="_TableName "></param>
/// <returns></returns>
//ID;
pFieldIID.Type_2 = esriFieldType.esriFieldTypeInteger;
pFieldIID.Name_2 = "ID";
//;
IField pFieldCount = new FieldClass();
pFieldICount.Type_2 = esriFieldType.esriFieldTypeInteger;
pFieldICount.Name_2 = "";
//
ESRI.ArcGIS.Geodatabase.IObjectClassDescription objectClassDescription = new
ESRI.ArcGIS.Geodatabase.ObjectClassDescriptionClass();
pTableFieldsEdit.AddField(pFieldID);
pTableFieldsEdit.AddField(pFieldCount);
return pTable;
/// <summary>
///
/// </summary>
/// <param name="_pPolygonFClass"></param>
/// <param name="_pPointFClass"></param>
/// <param name="_pTable"></param>
public void StatisticPointCount(IFeatureClass _pPolygonFClass, IFeatureClass
_pPointFClass, ITable _pTable)
{
IFeatureCursor pPolyCursor = _pPolygonFClass.Search(null, false);
int Count = 0;
spatialFilter.Geometry = pPolGeo;
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;
if (pPointCur != null)
{
IFeature pPointFeature = pPointCur.NextFeature();
if (Count != 0)
{
}
}
4.13
Geodatabases
FeatureDataConverter GeoDBDataTransfer
copy/paste class
FeatureDataConverter GeoDBDataTransfer
IFieldChecker
IEnumInvalidObject
IFeatureProgress
/// <summary>
///
/// </summary>
/// <param name="_pSWorkspaceFactory"></param>
/// <param name="_pSWs"></param>
/// <param name="_pSName"></param>
/// <param name="_pTWorkspaceFactory"></param>
//
IFieldChecker pFieldChecker = new FieldCheckerClass();
pFieldChecker.InputWorkspace = pSWorkspace;
pFieldChecker.ValidateWorkspace = pTWorkspace;
//
pFieldChecker.Validate(sourceFields, out pEnumFieldError, out pTargetFields);
if (pEnumFieldError != null)
{
// Handle the errors in a way appropriate to your applicat ion.
Console.WriteLine("Errors were encountered during field validation." );
}
//
IFeatureDataConverter pFDConverter = new FeatureDataConverterClass();
ConvertFeatureClass(pSwf,"E:\\s.mdb","s",pDwf,"E:\\d.mdb","d");
4.14 Querylayer
SQL DBMS
ArcMap SQL
ArcMap
ArcMap
ArcGIS DBMS
ArcMap DBMS
GIS
4.15
DBMS ArcMap
API
(.lyr) (.lpk)
ArcMap
ObjectID
ObjectID ArcGIS
ArcGIS
GUID
ArcGIS
ArcGIS
ObjectID ArcGIS
ArcGIS
ArcGIS
ArcGIS
ESRI_OID
ISqlWorkspace.GetTables IStringArray
ISqlWorkspace.OpenQueryCursor
ISqlWorkspace.OpenQueryClass ITable
IWorkspace ISqlWorkspace
IWorksapce
QueryLayer
1 SqlWorkspaceFactory
2 SqlWorkspace
Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory");
IWorkspaceFactory pWorkspaceFactory =
(IWorkspaceFactory)Activator.CreateInstance(pFactoryType);
//
IPropertySet pConnectionProps = new PropertySetClass();
pConnectionProps.SetProperty("dbclient", "Oracle11g");
pConnectionProps.SetProperty("serverinstance", "esri");
pConnectionProps.SetProperty("authentication_mode", "DBMS");
pConnectionProps.SetProperty("user", "scott");
pConnectionProps.SetProperty("password", "arcgis");
//
IWorkspace workspace = pWorkspaceFactory.Open(pConnectionProps, 0);
//
return pFeatureLayer;
Geometry GIS
ArcGIS Engine :
Geomtry
ArcGIS Engine Geometry IGometry IGeometry
IGeometry
IGeometry.Dimension 0
1
IGeometry.SpatialReference
IGeometry.Project
5.1
GIS
GIS
Point
Z M Point :
/// <summary>
///
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
private IPoint ConstructPoint(double x, double y)
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(x, y);
return pPoint;
MultiPoint
MultiPoint
Multipoint Point
Multipoint :
Segment
Segment Segement
Segment Segment 4
4
ISegment
Segment Segement
Path
Path
Ring
Ring Path
Polyline
Polyline path
ArcGIS Engine
Polyline Polyline
polyline segments
Polyline
1. Polyline Path
2. Polyline Path
3. Polyline Path
4.Path 0.
1. Path IPath::Simplify
Polyline
Segment,PathRing Polyline
Segment
Segment-Path-Ring Path
Segment-Path-Polyline
5.3 Polygone
/// <summary>
///
/// </summary>
/// <returns></returns>
pWKSPoint[i].X = pPointCollection.get_Point(i).X;
pWKSPoint[i].Y = pPointCollection.get_Point(i).Y;
pPoly.close();
return pPoly;
5.4 Curve
//QI ICurve
// Polyline
5.4.1.1
pPolygon.SimplifyPreserveFromTo();
return pPolygon;
}
5.5 Multipatch
Multipatch
Multipatch MultiPatch IGeometryCollection
Multipatch
GeneralMultiPatchCreator IGeneralMultiPatchInfo MultiPatch
IGeneralMultiPatchInfo MultiPatch
3D 3DSymbol Multipatch.
5.6 Geometry
Geometry Point
MultiPoint Path Segment Polyline
Path Polygon Ring Multipatch Triangle Strip Trangle
Fan, Trangle,Ring
ArcGIS Engine
IPointCollection,ISegmentCollection IGeometryCollection ArcGIS Engine
Polyline Path
Polygon Ring
Multipoint Point
GeometryBag GeometryBag
IGeometryCollection Geometry
GeometryCount
IGeometryCollection
IGeometryCollection Polygon
}
catch (Exception Err)
{
return null;
}
}
return null;
}
}
ISegmentCollection
IPointCollection
IPointCollection
Mullipoint,Path,Ring,Polyline,Polygon,TriangleFan,TrangleStrip,Trangle,Multipatch
PointCollection IPointCollection
AddPoint PointCollection
IPointCollection Point
Geometry
Polyline Path IGeometryCollection,
IPointCollection
Point / IPoint
5.6.1
5.6.1.1
pConGeoCollection.ConstructDivideEqual(pGeometry, inPoints,
esriConstructDivideEnum.esriDivideIntoPolylines);
return pEnumGeometry;
GeometryBag IGeometry
IGeometryCollection GeometryBag
GeometryBag GeometryBag
GeometryBag GIS
Esri shpfilecoverage
Geodatabase Geodatabase Shape Shape
ArcGIS
Shape
5.7
ArcGIS
5.7.1
5.7.1.1
5.7.1.2
,
() (m)
6 377
Bessel1841 6 356 078.965 299.152 843 4
397.155
5.7.1.3
,,
(, WGS1984), 80 54
.,
.,, ,.
NAD27NAD83 WGS84
NAD83 WGS84 NAD27
ArcGIS
5.7.1.4
5.7.2
5.7.2.1
(GCS) GCS
GCS GCS ArcGIS
5.7.2.2
X,Y
=( 54 80WGS84)+(Lambert
Mercator )+ ArcGIS
ArcGIS Engine
SpatialReferenceEnvironmentClass ISpatialReferenceFactory
ISpatialReferenceFactory int
5.7.3.1
ISpatialReference pToSpatialReference =
pSpatialReferenceEnvironemnt.CreateProjectedCoordinateSystem((int)esriSRProjCS4Type
.esriSRProjCS_Xian1980_3_Degree_GK_Zone_34);//80
if (pBool == true)//
{
5.7.3.2
7 ,
X,Y,Z
7 7
(),
ArcGIS Engine
IGeoTransformation
GeocentricTranslationClass
CoordinateFrameTransformationClass
7 3 7 IGeometry2
ProjectEx
// ISpatialReference pFromCustom =
pSpatialReferenceFactory.CreateESRISpatialReferenceFromPRJFile(@"E:\arcgis\Engine\z
idingyi.prj");
pFromPoint.X = 518950.788;
pFromPoint.Y = 4335923.97;
pZAware.ZAware = true;
pFromPoint.Z = 958.4791;
// ((IGeometry)pFromPoint).SpatialReference = pFromCustom;
//WGS84619
((IGeometry)pFromPoint).SpatialReference =
CreateCustomProjectedCoordinateSystem();
//
IProjectedCoordinateSystem projectedCoordinateSystem =
pSpatialReferenceFactory.CreateProjectedCoordinateSystem(( int)esriSRProjCS4Type.esr
iSRProjCS_Xian1980_GK_Zone_19);
//7
pCoordinateFrameTransformation.PutSpatialReferences(CreateCustomProjectedCoordinate
System(), projectedCoordinateSystem as ISpatialReference);
//
IGeometry2 pGeometry = pFromPoint as IGeometry2;
pGeometry.ProjectEx(projectedCoordinateSystem as ISpatialReference,
esriTransformDirection.esriTransformForward, pCoordinateFrameTransformation, false,
0, 0);
IProjectionGEN pProjection =
pSpatialReferenceFactory.CreateProjection((int)
esriSRProjectionType.esriSRProjection_GaussKruger) as IProjectionGEN;
IGeographicCoordinateSystem pGeographicCoordinateSystem =
pSpatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esri
SRGeoCS_WGS1984);
ILinearUnit pUnit =
pSpatialReferenceFactory.CreateUnit((int)esriSRUnitType.esriSRUnit_Meter) as
ILinearUnit;
IProjectedCoordinateSystem5 pProjectedCoordinateSystem =
pProjectedCoordinateSystemEdit as IProjectedCoordinateSystem5;
pProjectedCoordinateSystem.FalseEasting = 500000;
pProjectedCoordinateSystem.LatitudeOfOrigin = 0;
pProjectedCoordinateSystem.set_CentralMeridian(true,111);
pProjectedCoordinateSystem.ScaleFactor=1;
pProjectedCoordinateSystem.FalseNorthing=0;
return pProjectedCoordinateSystem;
6.1
IntersectClipUnionMerge
IBasicGeoProcessor
IBasicGeoProcessor Intersect
Intersect
p ub lic IFeatureClass I n t e r s e c t (
ITable inputTable,( )
bool useSelectedInput,
ITable overlayTable,
bool useSelectedOverlay,
double Tolerance,
IFeatureClassName outputName
IFeatureClassName
IntersectEsri
Intersect
pOutPut.ShapeType = _pFtClass.ShapeType;
pOutPut.ShapeFieldName = _pFtClass.ShapeFieldName;
pOutPut.FeatureType = esriFeatureType.esriFTSimple;
pWsN.WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory";
pWsN.PathName = _FilePath;
//,IName IDataset
pDatasetName.Name = _pFileName;
pDatasetName.WorkspaceName =pWsN;
return pFeatureClass;
Insetsect
6.2
GIS
(Relational Operators)
boolean
IRelationalOperator IRelationalOperatior
IRelationalOperator IRelationalOperator
IRelationalOperator.Contains
[C #]
p ub lic bool C o n t a i n s (
IGeometry other
);
IRelationalOperator
IFeatureClass pPolygonFClass = GetFeatureClass(@"D:\\", "
");
int Count = 0;
if (pRel.Contains(pPointGeo))
{
Count++;
}
pPointFeature = pPointCur.NextFeature();
}
if (Count != 0)
{
IRow pRow = pTable.CreateRow();
pRow.set_Value(1, pPolyFeature.get_Value(0));
pRow.set_Value(2, Count);
pRow.Store();
pPolyFeature = pPolyCursor.NextFeature();
6.3
ArcGIS Engine
IProximityOperatorIProximityOperator
Moran'I
Moran'I
Moran'I Where
Moran IProximityOperator
/// <summary>
///
/// </summary>
/// <param name="_FilePath"></param>
/// <param name="_TableName"></param>
/// <param name="_pFeatureClass"></param>
/// <param name="_FieldName"></param>
/// <returns></returns>
_pFeatureClass,string _FieldName)
{
IWorkspaceFactory pWks = new ShapefileWorkspaceFactoryClass();
//
ESRI.ArcGIS.Geodatabase.IObjectClassDescription objectClassDescription = new
ESRI.ArcGIS.Geodatabase.ObjectClassDescriptionClass();
pFieldEdit.Name_2 = _FieldName;
pTableFieldsEdit.AddField(pFieldEdit);
pFieldEdit.Type_2 = _pFeatureClass.Fields.get_Field(index).Type;
pFieldEditv.Name_2 = pFt.get_Value(index).ToString();
pFieldEditv.Type_2 = esriFieldType.esriFieldTypeInteger;
pTableFieldsEdit.AddField(pFieldEditv);
pFt = pFtCursor.NextFeature();
}
pRow .set_Value(1,pFt1.get_Value(index));
pRow.Store();
pFt1 = pFtCursor1.NextFeature();
}
return pTable;
pFt1 = pFtCur1.NextFeature();
int j = 0;
///
while (pFt1 != null)
{
IProximityOperator pProx = pFt1.Shape as IProximityOperator;
pFt2 = pFtCur2.NextFeature();
if(dis ==0)
{
pRow.set_Value(j + 2, 1);
pRow.Store();
}
pFt2 = pFtCur2.NextFeature();
j++;
}
j = 0;
pRow = pCursor.NextRow();
pFt1 = pFtCur1.NextFeature();
6.4
1000
1000
ITopologicalOperator ITopologicalOperator
ITopologicalOperator (geometries)
pActView.ScreenDisplay.SetSymbol(symbol);
pActView.ScreenDisplay.DrawPolygon(pGeo);
axMapControl1.ActiveView.Refresh();
6.5
GIS
6.6
GIS
(IDW)
6.7
IFeatureClassDescriptor
IRasterAnalysisEnvironment
IRasterAnalysisEnvironment Mask
IRasterRadius
IDW
RasterRadiusClass
object o = Type.Missing;
// pRasterAEnv.Mask = Geo;
pRasterAEnv.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref
pCellSize);
return pGeoIDW;
6.8 GP
GIS
ArcGIS 10 Geoprocessing
ArcMap Engine
GeoProcessor
Java
GP Intersect
ArcGIS Engine
Intersect ArcGIS
GIS
GIS
3S
7.1
7.2
.,.
, RGB ,, CMYK
, HSI
7.3 RGB
16777216
G 0 B 0 255
7.3.1 HSV
Hue HSaturation SValue V
HSV
H V 0 120
1HSV CIE
()V=0H S
S=0V=1H
V=1S=1HSV
7.3.2 HSI
HSI Hue
H SI
HIS
HSI
HSI RGB
7.3.3 CMYK
CMYKCyan, Magenta, Yellow
CM YK RG B
(C)(M)(Y)
CMY (C)(M)(Y)(BK)
CMYKCMYK
CMYK CMYK
CMYK
RGB CMYK
RGB
CMYK
XYZ LAB
7.3.4
200
IColorRamp 4
iColorRamap 4
7.4
TextSymbol
7.5 MarkerSymbol
MarkerSymbol AE Markersymbol
MmarkerSymbol IMarkerSymbol
7.6 LineSymbol
MarkerSymbol
7.7 FillSymbol
IFillSymbol
AE IFillSymbol
7.8
ArcGIS
Symbol
ArcGIS 5
IGeoFeatureLayer
FeatureRender AE
OMD
7.8.1
ArcMap
1.
2. /properties/Symbolygy
7.8.1.1
IUniqueValueRenderer
UniqueValueRenderer
pUnique.FieldCount = 1;
pUnique.set_Field(0, pFieldName);
//
IFillSymbol pFillSymbol1;
////
//pFillSymbol1 = new SimpleFillSymbolClass();
//pFillSymbol1.Color = GetRGBColor(103, 252, 179) as IColor;
////
//IFillSymbol pFillSymbol2 = new SimpleFillSymbolClass();
//pFillSymbol2.Color = GetRGBColor(125, 155, 251) as IColor;
//
pColorRamp.StartHue = 0;
pColorRamp.MinValue = 20;
pColorRamp.MinSaturation = 15;
pColorRamp.EndHue = 360;
pColorRamp.MaxValue = 100;
pColorRamp.MaxSaturation = 30;
pColorRamp.Size = pCount ;
//pColorRamp.Size = pUniqueValueRenderer.ValueCount;
bool ok = true;
pColorRamp.CreateRamp(out ok);
//24255.
int i = 0;
//
//if (i % 2 == 0)
//{
// pUnique.AddValue(Convert.ToString(pFt.get_Value(pIndex)), pFieldName,
pFillSymbol1 as ISymbol);
//}
//else
//{
// pUnique.AddValue(Convert.ToString(pFt.get_Value(pIndex)), pFieldName,
pFillSymbol2 as ISymbol);
//}
//i++;
pFillSymbol1.Color = pColor;
pUnique.AddValue(Convert.ToString(pFt.get_Value(pIndex)), pFieldName,
pFillSymbol1 as ISymbol);
pFt = pFtCursor.NextFeature();
// pColor = pEnumRamp.Next();
pMapcontrol.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
null);
pRGB.Red = R;
pRGB.Green = G;
pRGB.Green = B;
return pRGB;
7.8.2
7.8.2.1
IClassBreaksRenderer
ClassBreaksRenderer
IBasicHistogram
Frenquen)
IClassifyGEN
ArcGIS
IClassifyGEN
IClassifyGEN Classify
IClassBreaksRenderer.MinimumBreak = IClassifyGEN.ClassBreaks(0)
IClassBreaksRenderer.Breaks(0) = IClassifyGEN.ClassBreaks(1)
IActiveView pActiveView;
pActiveView = pMapControl.ActiveView;
//
ITable pTable;
IClassifyGEN pClassify;//C#
ITableHistogram pTableHist;//
IBasicHistogram pBasicHist;//
double[] ClassNum;
int ClassCountResult;//
IHsvColor pFromColor;
IHsvColor pToColor;//
IAlgorithmicColorRamp pAlgo;
IMap pMap;
pMap = pMapControl.Map;
pMap.ReferenceScale = 0;
pTableHist.Table = pTable;
pTableHist.Field = pFieldName;
object datavalus;
object Frenquen;
try
{
pClassify.Classify(datavalus, Frenquen, ref ClassCount);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
//
ClassNum = (double[])pClassify.ClassBreaks;
ClassCountResult = ClassNum.GetUpperBound(0);//
IClassBreaksRenderer pClassBreak;
pClassBreak.Field = pFieldName;
pClassBreak.BreakCount = ClassCountResult;
pClassBreak.SortClassesAscending = true;
pAlgo.Algorithm = esriColorRampAlgorithm.esriHSVAlgorithm;
pAlgo.FromColor = pFromColor;
pAlgo.ToColor = pToColor;
pAlgo.Size = ClassCountResult;
bool ok;
pAlgo.CreateRamp(out ok);
IEnumColors pEnumColor;
pEnumColor = pAlgo.Colors;
pEnumColor.Reset();
IColor pColor;
ISimpleFillSymbol pSimFill;
pSimFill.Color = pColor;
// pSimFill.Color = pRgbColor[indexColor ];
pSimFill.Style = esriSimpleFillStyle.esriSFSSolid;
//
}
public IHsvColor Hsv(int hue, int saturation, int val)
{
IHsvColor pHsvC;
pHsvC.Hue = hue;
pHsvC.Saturation = saturation;
pHsvC.Value = val;
return pHsvC;
}
pRGB.Red = r;
pRGB.Green = g;
pRGB.Blue = b;
return pRGB;
7.8.3
7.8.3.1
IProportionalSymbolRenderer ProportionalSymbolRenderer
pProRender.Field = pFieldName;
pProRender.ValueUnit = esriUnits.esriUnknownUnits;
pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
pMarkerSymbol.Size = 2;
pDataStat.Field = pFieldName;
pProRender.MinDataValue = pDataStat.Statistics.Minimum;
pProRender.MaxDataValue = pDataStat.Statistics.Maximum;
pLineS.Width = 2;
pFillS.Outline = pLineS;
pProRender.BackgroundSymbol = pFillS;
pMapcontrol.ActiveView.Refresh();
pRGB.Red = r;
pRGB.Green = g;
pRGB.Blue = b;
return pRGB;
7.8.4
IGeoFeatureLayer pGeolayer;
IActiveView pActiveView;
pActiveView = pMapcontrol.ActiveView;
IFillSymbol pFillSymbol;
ILineSymbol pLineSymbol;
pLineSymbol.Width = 2;
pFillSymbol.Outline = pLineSymbol;
ISimpleRenderer pSimpleRender;//
pSimpleRender.Description = "China";
pSimpleRender.Label = "SimpleRender";
ITransparencyRenderer pTrans;
pTrans.TransparencyField = Field;
//
//
pRGB.Red = R;
pRGB.Green = G;
pRGB.Green = B;
return pRGB;
7.8.5
//////////////////////////////////////
//Calculate the max value of the data field to scale the chart
pDataStat.Field = pFieldName1;
pRGB.Red = r;
pRGB.Green = g;
pRGB.Blue = b;
return pRGB;
7.8.6
IDotDensityRenderer pDotDensityRenderer;//
IDotDensityFillSymbol pDotDensityFill;//
IRendererFields pRendFields;//
ISymbolArray pSymbolArry;
IActiveView pActiveView;
pActiveView = pMapControl.ActiveView;
pRendFields.AddField(pFieldName, pFieldName); //
pDotDensityFill.DotSize =2.46;
ISimpleMarkerSymbol pSimpleMark;
pSimpleMark.Style = esriSimpleMarkerStyle.esriSMSDiamond;
pSimpleMark.Size = 2.46;
pSymbolArry.AddSymbol(pSimpleMark as ISymbol);
pDotDensityRenderer.DotDensitySymbol = pDotDensityFill;
pDotDensityRenderer.DotValue = pValue;
pDotDensityRenderer.CreateLegend();
pGeoLayer.Renderer = (IFeatureRenderer)pDotDensityRenderer;
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
null);
}
public IRgbColor GetRGBColor(int r, int g, int b)
{
IRgbColor pRGB;
pRGB.Red = r;
pRGB.Green = g;
pRGB.Blue = b;
return pRGB;
7.8.7
class BarRender
{
pGeoFeatureLayer.ScaleSymbols = true;
//
IChartRenderer pChartRenderer = new ChartRendererClass();
//pChartRenderer
IRendererFields pRendererFields;
pRendererFields = (IRendererFields)pChartRenderer;
//---
pRendererFields.AddField(pFieldName1, pFieldName1);
pRendererFields.AddField(pFieldName2, pFieldName2);
pFieldIndecies[0] = pTable.FindField(pFieldName1);
pFieldIndecies[1] = pTable.FindField(pFieldName2);
pDataStat.Field = pFieldName2;
pBarChartSymbol.Width = 6;
IChartSymbol pChartSymbol;
pChartSymbol = pBarChartSymbol as IChartSymbol;
IMarkerSymbol pMarkerSymbol;
pMarkerSymbol = (IMarkerSymbol)pBarChartSymbol;
IFillSymbol pFillSymbol;
//pChartSymbol
pChartSymbol.MaxValue = pMax;
// bars
pMarkerSymbol.Size = 80;
//bar
//
ISymbolArray pSymbolArray = (ISymbolArray)pBarChartSymbol;
//
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetRGBColor(193, 252, 179) as IColor;
pSymbolArray.AddSymbol(pFillSymbol as ISymbol);
//
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetRGBColor(145, 55, 251) as IColor;
pSymbolArray.AddSymbol(pFillSymbol as ISymbol);
pChartRenderer.UseOverposter = false;
//
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pChartRenderer;
//TOOCotrol
IActiveView pActiveView = pMapcontrol.ActiveView as IActiveView;
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
null);
pRGB.Red = r;
pRGB.Green = g;
pRGB.Blue = b;
return pRGB;
}
}
8.1
GIS
GIS
RasterBand
DEM
RasterCatalog
.
ArcGIS 10
8.1.1
ArcGIS Desktop
ArcGIS
ArcGIS 3D Analyst -
Grid
GRID
,,.
8.1.2
GeoAnalyst 3D ,.
Datasourcesraster . GeoAnalyst Object OMD :
8.1.3 ( helper)
, ArcGIS Engine ,,
OMD (
IDW kriging
// FeatureClassDescriptor
//
IRasterRadius pRasRadius = new RasterRadiusClass();
object object_Missing = System.Type.Missing;
8.1.4
1,
2,()
3,
4,
Processings Extent
Cell
cell cell cell
cell cell .
Mask
ArcGIS Engine ,
IRasterAnalysisEnvironment
ArcGIS Desktop
ArcGIS Engine 3 ,
,,, ArcGIS ,
(GeoAnalyst library ) 3D ,
(IExtractionOp).
8.2
8.2.1
GIS
GIS ArcGIS . ArcGIS Engine
8.2.1.1 IRasterProps
,,.
int pH = pRasterPros.Height;//3973
int pW = pRasterPros.Width;//5629
8.2.1.2 IRasterCursor
,,(IPnt, IPnt,
IPoint)
while (pRasterCursor.Next())
{
IPixelBlock pPixBlock = pRasterCursor.PixelBlock;
int W = pPixBlock.Width;
//W
int H = pPixBlock.Height;
}
}
pPnt.X = 256;
pPnt.Y = 256;
while (pRasterCursor2.Next())
{
IPixelBlock pPixBlock = pRasterCursor2.PixelBlock;
int W = pPixBlock.Width;
int H = pPixBlock.Height;
8.2.1.3 IPixelBlock
ArcGIS
block 128*128. ArcGIS Engine IPixelBlock
8.2.1.4 IRasterLayerExport
IRasterLayerExport
IExtractionOp IExtractionOp
8.2.1.5 IRasterDataset
jpgimg
IRasterDataset pRasterDataset =
pRasterWs.OpenRasterDataset("MOD02HKM.A2010068.0310.005.2010069144441.GEO - .tif");
8.2.1.6 IRasterBandCollection
IRasterBandCollection
8.2.1.7 IRaster
8.2.1.8 IRasterLayer
Featurelayer Raster
IRasterDataset pRasterDataset =
pRasterWs.OpenRasterDataset("MOD02HKM.A2010068.0310.005.2010069144441.GEO - .tif");
pRasterLayer.CreateFromDataset(pRasterDataset);
axMapControl1.Map.AddLayer(pRasterLayer as ILayer); ;
8.2.1.9 IRasterGeometryProc
Raster Raster
Raster
NEAREST ILINEARCUBIC
1.
,
2.xy y X
x y xy
3.
16 x
y
rasterGeometryProc.Resample(rstResamplingTypes.RSP_CubicConvolution, newCellSize,
clipRaster);
pPntBlock.X = 128;
pPntBlock.Y = 128;
IRasterCursor pRasterCursor = pRaster2.CreateCursorEx(pPntBlock);
if (pRasterEdit.CanEdit())
{
IRasterBandCollection pBands = pRasterDatset as IRasterBandCollection;
IPixelBlock3 pPixelblock3 = null;
int pBlockwidth = 0;
int pBlockheight = 0;
System.Array pixels;
IPnt pPnt = null;
object pValue;
//Nodata
//IRasterProps pRasterPro = pRaster2 as IRasterProps;
do
{
pPixelblock3 = pRasterCursor.PixelBlock as IPixelBlock3;
pBlockwidth = pPixelblock3.Width;
pBlockheight = pPixelblock3.Height;
pixels = (System.Array)pPixelblock3.get_PixelData(k);
for (int i = 0; i < pBlockwidth; i++)
{
for (int j = 0; j < pBlockheight; j++)
{
if (Convert.ToInt32(pValue) == 0)
{
pixels.SetValue(Convert.ToByte(50), i, j);
}
}
}
pPixelblock3.set_PixelData(k, pixels);
}
pPnt = pRasterCursor.TopLeft;
pRasterEdit.Write(pPnt, (IPixelBlock)pPixelblock3);
}
while (pRasterCursor.Next());
System.Runtime.InteropServices.Marshal.ReleaseComObject(pRasterEdit);
}
/// <summary>
///
/// </summary>
/// <param name="pRasterDataset"></param>
/// <param name="pOutputWorkspace"></param>
/// <param name="pWidth"></param>
/// <param name="pHeight"></param>
public void CreateTilesFromRasterDataset(IRasterDataset pRasterDataset, IWorkspace
pOutputWorkspace, int pWidth, int pHeight)
{
pRasterProps.Height = pHeight;
pRasterProps.Width = pWidth;
pRasterProps.Extent = pTileExtent;
pSaveAs = (ISaveAs)pRasterProps;
pSaveAs.SaveAs("tile_" + i + "_" + j + ".tif", pOutputWorkspace, "TIFF");
}
}
}
8.3
8.3.1
3D
3D 3D
3D
8.3.2
GIS
GIS
8.3.3 TIN
(TIN) TIN
8.4
ISurfaceop Isurface ,,
,.
ESRI.ArcGIS.GeoAnalyst , ESRI.ArcGIS.GeoAnalyst
3D . ISurfaceOp
ISurfaceOp
, RasterSurfaceClass ESRI.ArcGIS.Analyst3D ,
3D ,Isurface
,:
8.4.2
8.4.2.1
pRasterNeighborhood.SetRectangle(3, 3,
esriGeoAnalysisUnitsEnum.esriUnitsCells);
IGeoDataset pGeoOutput =
pNeighborhoodOP.BlockStatistics(GeoDataset,esriGeoAnalysisStatisticsEnum.esriGeoAnalysisStat
sMean, pRasterNeighborhood, true);
return pGeoOutput;
8.4.2.2
ESRI.ArcGIS.Geodatabase.IGeoDataset pGeoOutput =
pExtractionOp.Polygon(pGeoDataset, pPolygone, true);
return pGeoOutput;
8.4.2.3
RasterDensityOp IDensityOp
//
IRasterAnalysisEnvironment pEnv = pDensityOp as IRasterAnalysisEnvironment;
pEnv.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref
object_cellSize);
return pRaster;
8.4.2.4 IDistanceOp
return pGeoDatasetOutput;
8.4.2.5 RasterConvertHelperClass
IRasterDataset pRasterDataset =
GetRasterWorkspace(pRasterWs).OpenRasterDataset(pRasterDatasetName);
/// <summary>
/// Grid
/// </summary>
/// <param name="pFeaureClass"></param>
/// <param name="pRasterWorkspaceFolder"></param>
/// <param name="pCellsize"></param>
/// <param name="pGridName"></param>
/// <returns></returns>
public IGeoDataset CreateGridFromFeatureClass(IFeatureClass pFeaureClass, String
pRasterWorkspaceFolder, double pCellsize ,string pGridName)
{
IRasterAnalysisEnvironment pAnalysisEnvironment =
(ESRI.ArcGIS.GeoAnalyst.IRasterAnalysisEnvironment)pConversionOp; // Explicit Cast
pAnalysisEnvironment.OutWorkspace = pWorkspace;
pAnalysisEnvironment.SetCellSize(ESRI.ArcGIS.GeoAnalyst.esriRasterEnvSettingEnum.esriRasterE
nvValue, ref pObjectCellSize);
pAnalysisEnvironment.SetExtent(ESRI.ArcGIS.GeoAnalyst.esriRasterEnvSettingEnum.esriRasterEnv
Value, ref object_Envelope, ref object_Missing);
pAnalysisEnvironment.OutSpatialReference = pSpatialReference;
return pGeoOutput;
8.4.3 3D
8.4.3.1
8.4.3.2
if(axMapControl1.Map.get_Layer(0)!=null)
{
IRasterLayer pRasterLayer = axMapControl1.Map.get_Layer(0) as IRasterLayer;
pRasterSurface.PutRaster(pRasterLayer.Raster, 0);
object pRef=0.13;
pPoint1.Z = pZ1;
pPoint1.X = pPolyline.FromPoint.X;
pPoint1.Y = pPolyline.FromPoint.Y;
pPoint2.Z = pZ2;
pPoint2.X = pPolyline.ToPoint.X;
pPoint2.Y = pPolyline.ToPoint.Y;
pLineElementV.Geometry = pVPolyline;
pLinesymbolV.Width = 2;
pColorV.Green =255;
pLinesymbolV.Color = pColorV;
pLineV.Symbol = pLinesymbolV;
axMapControl1.ActiveView.GraphicsContainer.AddElement(pLineElementV,
0);
}
if (pInPolyline != null)
{
pLineElementIn.Geometry = pInPolyline;
pLinesymbolIn.Width = 2;
pLinesymbolIn.Color = pColorIn;
ILineElement pLineIn = pLineElementIn as ILineElement;
pLineIn.Symbol = pLinesymbolIn;
axMapControl1.ActiveView.GraphicsContainer.AddElement(pLineElementIn,
1);
8.4.3.3 Tin
ITinSurface Interface
Tin 3D .Tin
Tin
if (pTinWorkspace.get_IsTin(tinName))
{
pTin = pTinWorkspace.OpenTin(tinName);
pTinLayer.Dataset = pTin;
pTinLayer.ClearRenderers();
return pTinLayer;
}
else
{
MessageBox.Show("Tin");
return null;
pTinLayer.Dataset = pTin;
axMapControl1.Map.AddLayer(pTinLayer as ILayer);
Tin
/// <summary>
/// Tin
/// </summary>
/// <param name="pFeatureClass"></param>
/// <param name="pField"></param>
/// <param name="pPath"></param>
/// <returns></returns>
public ITin CreateTin(IFeatureClass pFeatureClass, IField pField, string pPath)
{
IGeoDataset pGeoDataset = pFeatureClass as IGeoDataset;
Tin
//
pTinSurface.Contour(0, 2, pFeatureClass, "Height", 0);
}
pFeatLayer.Name = "";
pFeatLayer.FeatureClass = pFeatureClass;
axMapControl1.Map.AddLayer(pFeatLayer as ILayer);
AE
pFeatLayer.Name = "";
pFeatLayer.FeatureClass = pFeatureClass;
axMapControl1.Map.AddLayer(pFeatLayer as ILayer);
/// <summary>
///
/// </summary>
/// <param name="pFeatureClass"></param>
/// <param name="pTin"></param>
void CreateVr(IFeatureClass pFeatureClass ,ITin pTin)
{
ITinNodeCollection pTinColl = pTin as ITinNodeCollection;
8.5
Esri ESRI.ArcGIS.SpatialAnalystTools
ESRI.ArcGIS.Analyst3Dtools
8.6
/// <summary>
///
/// </summary>
/// <param name="pRasterDataset"></param>
public static void CalculateStatsAndPyramids(IRasterDataset pRasterDataset)
{
//
for (int i = 0; i < pBandColl.Count; i++)
{
IRasterBand pRasterBand = pBandColl.Item(i);
pRasterBand.ComputeStatsAndHist();
}
//
8.7
8.8
return pColormapRender;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}
8.9
GIS
9.1.1 ?
ArcGIS Engine
IWorkspaceEdit
Geodatabase
()
(SDE )
9.1.2
/ ,
UndoEditOperation RedoEditOperation,
3 SDE
4,
9.1.3
ArcGIS Engine
ArcGIS Engine
pRow.set_Value(2, "");
pRow.Store();
//
pWorkspaceEdit.StopEditOperation();
//
pWorkspaceEdit.StopEditing(true);
}
9.2 IWorkspaceEdit
IEngineEdito Geodatabase
IWorkspaceEdit
1000
0.978
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button6_Click_1(object sender, EventArgs e)
{
IWorkspaceFactory pWsF = new ShapefileWorkspaceFactory();
pFt.FeatureClass = pFtClass;
pFt.Name = "";
axMapControl1.Map.AddLayer(pFt as ILayer);
axMapControl1.Refresh();
//Idataset,
pWsEdit.StartEditing(true);
pWsEdit.StartEditOperation();
pBoolStart = pWsEdit.IsBeingEdited();
pPoint.X = 48 + i * 102;
pPoint.Y = 65 + i * 10;
polyline.FromPoint = pPoint;
polyline.ToPoint = pPoint2;
pFeatureBuffer.Shape = polyline;
pFeatureBuffer.set_Value(2, i);
pFtCusor.Flush();
pWsEdit.StopEditing(true);
axMapControl1.Refresh();
9.3 IMultiuserWorkspaceEdit
SDE
IMultiuserWorkspaceEdit.StartMultiuserEditing SDE
IWorksspaceEditor.start(). SDE
IMultiuserWorkspaceEdit.StartMultiuserEditing
SDE
public void StartSDEVersion(IWorkspace pWorkspace)
{
//
pMWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
//
pWorkspaceEdit.StartEditOperation();
//...
//
pWorkspaceEdit.StopEditOperation();
//
pWorkspaceEdit.StopEditing(true);
9.4 IEngineEditor
ArcGIS
ArcGIS Engine
IEngineEditor
IEngineEditor Task
Task
ArcMap
ArcMAP Task
Task
IEngineEditTask
IEngineEditor IWorkspaceEdit
IEngineEditor IWorkspaceEdit
, IWorkspaceEdit
IWorkspaceEdit
IEngineEditor
ArcMap Editor
1Start Editing
2 Targetlayer
4 4 3
EngineEditorClass ,
IEngineEditor
IEngineEditLayer
IEngineEditSketch
(MousedownMousemove
9.5
VB.NET (AO)
C#(Engine) ArcGIS 10
9.5.1
pFtLayer.Name = "";
pFtLayer.FeatureClass = pFClass;
axMapControl1.AddLayer(pFtLayer as ILayer);
axMapControl1.Refresh();
pEngineEditor = new EngineEditorClass();
//
pEngineEditor.StartOperation();
//
IEngineEditLayers pEditLayer = pEngineEditor as IEngineEditLayers;
pEditLayer.SetTargetLayer(pFtLayer, 0);
//
pEngineEditor.CurrentTask = new CalculatContourTask() as IEngineEditTask;
//
pSketch.OnCreate(axMapControl1.Object);
//
if (pEngineEditor.EditState == esriEngineEditState.esriEngineStateEditing)
{
pEngineEditor.StopEditing(true);
}
9.5.2
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using System.Windows.Forms;
namespace EngineApplication
IFeatureLayer pFeatureLayer;
pEngineEditor = pEditor;
pEditSketch = pEngineEditor as IEngineEditSketch;
pEditSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
pEditLayer = pEditSketch as IEngineEditLayers;
((IEngineEditEvents_Event)pEditSketch).OnCurrentTaskChanged += new
IEngineEditEvents_OnCurrentTaskChangedEventHandler(OnCurrentTaskChanged);
}
((IEngineEditEvents_Event)pEditSketch).OnCurrentTaskChanged -=
OnCurrentTaskChanged;
if (pPolyline.IsEmpty == false)
{
pFormSetting.ShowDialog();
if (pFormSetting.DialogResult == DialogResult.OK)
{
pHeightName = pFormSetting.pFieldNames.Text;
pHeight = Convert.ToDouble(pFormSetting.dHeight.Text);
pInterval = Convert.ToDouble(pFormSetting.dInterval.Text);
pFormSetting.Dispose();
pFormSetting = null;
CalculateIntersect(pFeatureCursor, pPolyline);
MessageBox.Show("");
}
#endregion
void OnCurrentTaskChanged()
{
if (pEngineEditor.CurrentTask.Name == "CalculateContourTask")
{
PerformSketchToolEnabledChecks();
}
}
#endregion
//
ISpatialFilter pSpatialFilter = new SpatialFilter();
pSpatialFilter.Geometry = pGeometry;
//
//
//
pSpatialFilter.GeometryField = pFeatureClass.ShapeFieldName;
//
pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
//
IFeatureCursor pFeatureCursor = pFeatureClass.Search(pSpatialFilter,
false);
return pFeatureCursor;
//
private double pHeight;
//
private double pInterval;
//
private string pHeightName;
if (pFeatureCursor == null)
{
return;
}
//
IMultipoint pIntersectionPoints = null;
//
IPointCollection pPointColl = null;
//
pFeature = pFeatureCursor.NextFeature();
}
// IProximityOperator
//pFeatureL
//
int pCount = pFeatureList.Count;
double[] sortArray = new double[pCount];
for (int i = 0; i <= pCount - 1; i++)
{
try
{
pFeature = pFeatureList[i];
//:
pIntersectionPoints = pTopoOperator.Intersect(pFeature.Shape,
esriGeometryDimension.esriGeometry0Dimension) as IMultipoint;
pDic.Add(GetDistace(pPointF, pPointColl.get_Point(0)),
pFeatureList[i]);
//
//
pFeature = pFeatureCursor.NextFeature();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
//
int pFieldIndex =
pFeatureLayer.FeatureClass.Fields.FindField(pHeightName);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="pPoint1"></param>
/// <param name="pPoint2"></param>
/// <returns></returns>
private double GetDistace(IPoint pPoint1, IPoint pPoint2)
{
//pPoint1.X = GetPlan(pPoint1.X);
//pPoint1.Y = GetPlan(pPoint1.Y);
//pPoint2.X = GetPlan(pPoint2.X);
//pPoint2.Y = GetPlan(pPoint2.Y);
//return (pPoint1.X - pPoint2.X) * (pPoint1.X - pPoint2.X) + (pPoint1.Y -
pPoint2.Y) * (pPoint1.Y - pPoint2.Y);
return pProximity.ReturnDistance(pPoint2);
}
pEditSketch.GeometryType = esriGeometryType.esriGeometryPolyline;
#endregion
9.5.3
this.pFeatureClass = pFtClass;
}
IFeatureClass pFeatureClass;
pFieldNames.Items.Clear();
for (int i = 0; i <= pFeatureClass.Fields.FieldCount - 1; i++)
{
if (pFeatureClass.Fields.get_Field(i).Type ==
esriFieldType.esriFieldTypeDouble || pFeatureClass.Fields.get_Field(i).Type ==
esriFieldType.esriFieldTypeInteger)
{
pFieldNames.Items.Add(pFeatureClass.Fields.get_Field(i).Name);
}
}
10
PDFbmp
ArcMap
BMP,JPG PDF,SVG.
IExport
10 10 ArcGIS
10 Window 96dpi
10.1
IExportVector 5
EMF
private void ExportEMF()
{
IActiveView pActiveView;
pActiveView = axPageLayoutControl1.ActiveView;
IExport pExport;
pExport = new ExportEMFClass();
pExport.ExportFileName = @"E:\arcgis\Engine\ExportEMF.emf";
pExport.Resolution = 300;
tagRECT exportRECT;
exportRECT = pActiveView.ExportFrame;
IEnvelope pPixelBoundsEnv;
pPixelBoundsEnv = new EnvelopeClass();
pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top,
exportRECT.right, exportRECT.bottom);
pExport.PixelBounds = pPixelBoundsEnv;
int hDC;
hDC = pExport.StartExporting();
pActiveView.Output(hDC, (int)pExport.Resolution, ref exportRECT, null, null);
pExport.FinishExporting();
pExport.Cleanup();
}
PDF
private void ExportPDF()
{
IActiveView pActiveView;
pActiveView = axPageLayoutControl1.ActiveView;
IEnvelope pEnv;
pEnv = pActiveView.Extent;
IExport pExport;
pExport = new ExportPDFClass();
pExport.ExportFileName = @"E:\arcgis\Engine\ExportPDF.pdf";
pExport.Resolution = 30;
tagRECT exportRECT;
exportRECT.top = 0;
exportRECT.left = 0;
exportRECT.right = (int)pEnv.Width;
exportRECT.bottom = (int)pEnv.Height;
IEnvelope pPixelBoundsEnv;
pPixelBoundsEnv = new EnvelopeClass();
pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.bottom,
exportRECT.right, exportRECT.top);
pExport.PixelBounds = pPixelBoundsEnv;
int hDC ;
hDC = pExport.StartExporting();
pActiveView.Output(hDC, (int)pExport.Resolution, ref exportRECT, null, null);
pExport.FinishExporting();
pExport.Cleanup();
10.2
IExportImage 5
JPG
public void CreateJPEGHiResolutionFromActiveView(IActiveView pActiveView,String
pFileName, Int32 pScreenResolution,
Int32 pOutputResolution)
{
ESRI.ArcGIS.Output.IExport pExport = new ESRI.ArcGIS.Output.ExportJPEGClass();
pExport.ExportFileName = pFileName;
pExport.Resolution = pOutputResolution;
ESRI.ArcGIS.Display.tagRECT pExportRECT;
pExportRECT.left = 0;
pExportRECT.top = 0;
pExportRECT.right = pActiveView.ExportFrame.right * (pOutputResolution / pScreenResolution);
pExportRECT.bottom = pActiveView.ExportFrame.bottom * (pOutputResolution /
pScreenResolution);
pExport.Cleanup();
11 .ArcGIS Engine
11.1 (AddXY )
IXYEvent2FieldsProperties X,Y
IXYEventSourceName
/// <summary>
/// Addxy
/// </summary>
/// <param name="pTable"></param>
/// <param name="pSpatialReference"></param>
/// <returns></returns>
11.2
ArcMap
ITableSort ITableSort
ITableSort
/// <summary>
/// true false
/// </summary>
/// <param name="_pTable"></param>
/// <param name="_FieldName"></param>
/// <param name="_Bool"></param>
void Sort(ITable _pTable, string _FieldName, bool _Bool)
{
ITableSort pTableSort = new TableSortClass();
pTableSort.Table = _pTable;
pTableSort.Fields = _FieldName;
pTableSort.set_Ascending(_FieldName, _Bool);
pTableSort.Sort(null);
11.3
11.3.1
,,
11.3.2
1.
2.
3.
1.
2.
3.
ArcGIS ArcGIS ArcGIS 10
Weights based on feature attribute fields More robust attribute (weight) model
uses custom features: simple/complex edge uses simple features: points and lines
Geometric Network
()
A. /
B./
C.
D.
E.
Geometric Edges
Junctions
Geometric Junctions
Junctions
11.3.3.1
1 Sources Sinks
2 Network Weight
Feature
Weight.
True
4 Connectivity
Geometric Network
Connectivity ArcCatalog
Edge-Edge Connectivity
11.3.3.2
Geometric Network
API ArcMap
1 Catalog
4 enable
5 source sink
enable
sink source
/// <summary>
///
/// </summary>
return pWs;
//
pNetworkLoader.NetworkName = _pGeometricName;
//
pNetworkLoader.NetworkType = esriNetworkType.esriNTUtilityNetwork;
//
if (pNetworkLoader.CanUseFeatureClass("PrimaryLine") ==
esriNetworkLoaderFeatureClassCheck.esriNLFCCValid)
{
pNetworkLoader.AddFeatureClass("PrimaryLine",
esriFeatureType.esriFTComplexEdge, null, false);
}
if (pNetworkLoader.CanUseFeatureClass("Feeder") ==
esriNetworkLoaderFeatureClassCheck.esriNLFCCValid)
{
pNetworkLoader.AddFeatureClass("Feeder",
esriFeatureType.esriFTSimpleJunction,
null, false);
}
// enablefalsetrue
INetworkLoaderProps pNetworkLoaderProps =
(INetworkLoaderProps)pNetworkLoader;
pNetworkLoader.PreserveEnabledValues = false;
pNetworkLoader.SnapTolerance = 0.02;
//
pNetworkLoader.AddWeight("Weight", esriWeightType.esriWTDouble, 0);
// PrimaryLineSHAPE_Length
pNetworkLoader.AddWeightAssociation("Weight", "PrimaryLine",
"SHAPE_Length");
//
pNetworkLoader.LoadNetwork();
ITraceFlowSolverGEN
int intEdgeUserID;
int intEdgeUserSubID;
int intEdgeID;
IPoint pFoundEdgePoint;
double dblEdgePercent;
//,INetwork
pNetSolver.SourceNetwork = pNetwork;
pPointToEID.SourceMap = _pMap;
pPointToEID.GeometricNetwork = _pGeometricNetwork;
pPointToEID.SnapTolerance = _pDist;
pNetFlag.UserClassID = intEdgeUserClassID;
pNetFlag.UserID = intEdgeUserID;
pNetFlag.UserSubID = intEdgeUserSubID;
pNetSolverWeights.FromToEdgeWeight = pNetWeight;//
pNetSolverWeights.ToFromEdgeWeight = pNetWeight;//
//FindPath
IEnumNetEID pEnumNetEID_Junctions;
IEnumNetEID pEnumNetEID_Edges;
pTraceFlowSolver.FindPath(esriFlowMethod.esriFMConnected,
esriShortestPathObjFn.esriSPObjFnMinSum,
out pEnumNetEID_Junctions, out pEnumNetEID_Edges, pCount - 1, ref
pRes);
//
_pPathCost = 0;
for (int i = 0; i < pRes.Length; i++)
{
double m_Va = (double)pRes[i];
pEIDHelper.GeometricNetwork = _pGeometricNetwork;
pEIDHelper.OutputSpatialReference = pSpatialReference;
pEIDHelper.ReturnGeometries = true;
IEnumEIDInfo pEnumEIDInfo =
pEIDHelper.CreateEnumEIDInfo(pEnumNetEID_Edges);
pEnumEIDInfo.Reset();
pNewGeometryColl.AddGeometryCollection(pGeometry as
IGeometryCollection);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
A.
B.
C.
D.
E.
Network Dataset
Multimodal Network
Networks
Network Dataset
Connectivity Group
3Elevation Fields
Network Attribute
Network Attribute
Name
Usage Type
UnitCentimeterMeter
Data TypesBooleanIntegerFloatDouble
Use by Default
Cost
Descriptors
Restrictions
Hierarchy
Evaluators
Field Evaluator
Constant Evaluators
Evaluator
Setting Directions
Length Length
Edge Source
11.3.4.1
,
6
,
7
,
8
Networkdataset
/// <summary>
/// ,,
/// </summary>
/// <param name="_pWsName"></param>
/// <param name="_pDatasetName"></param>
/// <param name="_pNetName"></param>
/// <param name="_pFtName"></param>
pDENetworkDataset.Buildable = true;
// ,
IDEGeoDataset pDEGeoDataset = (IDEGeoDataset)pDENetworkDataset;
//
IDataElement pDataElement = (IDataElement)pDENetworkDataset;
pDataElement.Name = _pNetName;
//
INetworkSource pEdgeNetworkSource = new EdgeFeatureSourceClass();
pEdgeNetworkSource.Name = _pFtName;
pEdgeNetworkSource.ElementType = esriNetworkElementType.esriNETEdge;
//
IEdgeFeatureSource pEdgeFeatureSource =
(IEdgeFeatureSource)pEdgeNetworkSource;
pEdgeFeatureSource.UsesSubtypes = false;
pEdgeFeatureSource.ClassConnectivityGroup = 1;
pEdgeFeatureSource.ClassConnectivityPolicy
=esriNetworkEdgeConnectivityPolicy.esriNECPEndVertex;
//
pDENetworkDataset.SupportsTurns = false;
pDENetworkDataset.Sources = pSourceArray;
//
pEvalNetAttr.set_DefaultEvaluator(esriNetworkElementType.esriNETEdge,
(INetworkEvaluator)pNetConstEval);
pEvalNetAttr.set_DefaultEvaluator(esriNetworkElementType.esriNETJunction,
(INetworkEvaluator)pNetConstEval);
pEvalNetAttr.set_DefaultEvaluator(esriNetworkElementType.esriNETTurn,
(INetworkEvaluator)pNetConstEval);
//
pAttributeArray.Add(pEvalNetAttr);
pDENetworkDataset.Attributes = pAttributeArray;
//
ArcMapcatalog
//
pNetworkBuild.BuildNetwork(pGeoDataset.Extent);
/// <summary>
///
/// </summary>
/// <param name="_pFeatureDataset"></param>
/// <param name="_pDENetDataset"></param>
/// <returns></returns>
IFeatureDatasetExtension pFeatureDatasetExtension =
pFeatureDatasetExtensionContainer.FindExtension
(esriDatasetType.esriDTNetworkDataset);
IDatasetContainer2 pDatasetContainer2 =
(IDatasetContainer2)pFeatureDatasetExtension;
INetworkDataset pNetworkDataset =
(INetworkDataset)pDatasetContainer2.CreateDataset
(pDENetDataset);
return pNetworkDataset;
}
/// <summary>
/// _pFtClassStops_pPointC
/// </summary>
/// <param name="_pNaContext"></param>
/// <param name="_pFtClass"></param>
/// <param name="_pPointC"></param>
/// <param name="_pDist"></param>
void NASolve(INAContext _pNaContext,IFeatureClass _pFtClass, IPointCollection
_pPointC, double _pDist)
{
INALocator pNAlocator = _pNaContext.Locator;
for (int i = 0; i < _pPointC.PointCount; i++)
{
IFeature pFt = _pFtClass.CreateFeature();
pRowSubtypes.InitDefaultValues();
pNAlocator.QueryLocationByPoint(_pPointC .get_Point(i),ref
pNalocation,ref pPoint,ref _pDist);
pNAobject.NALocation = pNalocation;
pFt.set_Value(pStatusFieldIndex,
esriNAObjectStatus.esriNAObjectStatusOK);
pFt.set_Value(_pFtClass.FindField("Sequence"),
((ITable)_pFtClass).RowCount(null));
pFt.Store();
}
}
/// <summary>
///
/// </summary>
/// <param name="_pFeatureWs"></param>
/// <param name="_pDatasetName"></param>
/// <param name="_pNetDatasetName"></param>
/// <returns></returns>
INetworkDataset GetNetDataset(IFeatureWorkspace _pFeatureWs, string
_pDatasetName,string _pNetDatasetName)
{
ESRI.ArcGIS.Geodatabase.IFeatureDataset pFeatureDataset =
_pFeatureWs.OpenFeatureDataset(_pDatasetName);
ESRI.ArcGIS.Geodatabase.IFeatureDatasetExtensionContainer
pFeatureDatasetExtensionContainer = pFeatureDataset as
ESRI.ArcGIS.Geodatabase.IDataset pNetWorkDataset =
pDatasetContainer.get_DatasetByName(ESRI.ArcGIS.Geodatabase. esriDatasetType.esriDTN
etworkDataset, _pNetDatasetName);
/// <summary>
/// NetworkDatasetMap
/// </summary>
/// <param name="_pMap"></param>
/// <param name="_pNetworkDataset"></param>
void loadNet(IMap _pMap,INetworkDataset _pNetworkDataset)
{
INetworkLayer pNetLayer = new NetworkLayerClass();
pNetLayer.NetworkDataset = _pNetworkDataset;
_pMap.AddLayer(pNetLayer as ILayer);
}
/// <summary>
///
/// </summary>
/// <param name="_pNaSolver"></param>
/// <param name="_pNetworkDataset"></param>
/// <returns></returns>
public INAContext GetSolverContext(INASolver _pNaSolver, INetworkDataset
_pNetworkDataset)
{
//Get the Data Element
//Prepare the context for analysis based upon the current network dataset
schema.
pContextEdit.Bind(_pNetworkDataset, new GPMessagesClass());
return pContextEdit as INAContext;
}
/// <summary>
/// NALayer
/// </summary>
/// <param name="_pNaSover"></param>
/// <param name="_pNaContext"></param>
/// <returns></returns>
11.4
11.4.1
12
10 4
18 26
28 12
11.4.2
287 35 27
11.4.2.1 ID 20000013
0-25
pRouteLoc.MeasureUnit = esriUnits.esriFeet;
pRouteLoc.RouteID = _pID;
IRouteMeasureLineLocation rMLineLoc =
(IRouteMeasureLineLocation)pRouteLoc;
rMLineLoc.FromMeasure = _pFrom;
rMLineLoc.ToMeasure = _pTo;
esriLocatingError locError;
pRouteLocator.Locate(pRouteLoc , out pGeo, out locError);
pFeatureLayer.FeatureClass = pFtWs.OpenFeatureClass("routes");
pFeatureLayer.Name = "";
axMapControl1.Map.AddLayer(pFeatureLayer as ILayer);
axMapControl1.Refresh();
pColor.Red = 255;
pLinesymbol.Width = 100;
pGrahicsC.AddElement(pElement, 0);
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null,
null);
11.4.3
11.4.3.1
pRouteLocatorName.RouteFeatureClassName = pName;
pRouteLocatorName.RouteIDFieldName = _pPKName;
pRouteLocatorName.RouteMeasureUnit = esriUnits.esriFeet;
pName = (IName)pRouteLocatorName;
pRouteProp.AddErrorField = true;
pRouteProp.EventMeasureUnit = esriUnits.esriFeet;
pRouteProp.EventRouteIDFieldName = _pFKName;
IRouteMeasureLineProperties rMLineProp =
(IRouteMeasureLineProperties)pRouteProp;
rMLineProp.FromMeasureFieldName = _pFrom;
rMLineProp.ToMeasureFieldName = _pTo;
pName = (IName)pRouteEventSourceName;
return pFeatureClass;
12 .
Runtime
1)NetFramework35sp1
1 Engine
2 Setup
3 Setup -
4 Engine
1,,
Installation Designer
Folders
temp
Project Assistant
New EXE
launch WRE_B.exe
7 Project Assistant
92011 2008
2010 3
10 Net Framework
3.5 SP1
function OnMoved()
string szCommand,szCmdLine,szPath,svResult,LicPath;
begin
szPath=TARGETDIR^"temp";
szCommand = WINSYSDIR^"msiexec.exe";
LongPathToShortPath(szCommand);
//////////////////////// AE
then
szCmdLine =TARGETDIR^"temp"^"ArcGIS
Engine10"^"setup.msi\" /qn";
LongPathToShortPath(szCmdLine);
Delay(1);
< 0) then
abort;
endif;
endif;
/////////////////////////AE
if(SYSINFO.bIsWow64) then
(x86)\\ArcGIS\\bin\\SoftwareAuthorization.exe";
else
szCmdLine="C:\\Program Files\\Common
Files\\ArcGIS\\bin\\SoftwareAuthorization.exe";
endif;
then
abort;
endif;
endif;
if (ExistsDir(TARGETDIR^"temp")=0 ) then
endif ;
endif ;
end;
3.5 sp1
application Specify the command line for the application when the
12.3 3.
Setup.exe
10 :--ArcGIS-Administrator
Administrator
ArcGIS Engine 10
Local-Machine
Project Assistant
///// dotnetfx35sp1.exe
abort;
endif;
string szCommand,szCmdLine,szPath,svResult,LicPath,tempdir;
begin
szPath=TARGETDIR^"temp";
szCommand = WINSYSDIR^"msiexec.exe";
LongPathToShortPath(szCommand);
///// dotnetfx35sp1.exe
abort;
endif;
//////////////////////// AE
LongPathToShortPath(szCmdLine);
Delay(1);
abort;
endif;
endif;
/////////////////////////AE
0) then
abort;
endif;
endif;
abort;
endif;
endif;
if (ExistsDir(TARGETDIR^"temp")=0 ) then
endif ;
endif ;
end;