本文整理汇总了C#中PointClass类的典型用法代码示例。如果您正苦于以下问题:C# PointClass类的具体用法?C# PointClass怎么用?C# PointClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointClass类属于命名空间,在下文中一共展示了PointClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
PointStruct ps1 = new PointStruct();
ps1.x = ps1.y = 22;
PointStruct ps2 = new PointStruct();
ps2.x = ps2.y = 33;
ps1 = ps2;
ps2.x = ps2.y = 55;
Console.WriteLine("ps1 is ({0}, {1})", ps1.x, ps1.y);
Console.WriteLine("ps2 is ({0}, {1})", ps2.x, ps2.y);
Console.WriteLine("ps1.Equals(ps2) results in " + ps1.Equals(ps2));
PointClass pc1 = new PointClass();
pc1.x = pc1.y = 22;
PointClass pc2 = new PointClass();
pc2.x = pc2.y = 33;
pc1 = pc2;
pc2.x = pc2.y = 55;
Console.WriteLine("pc1 is ({0}, {1})", pc1.x, pc1.y);
Console.WriteLine("pc2 is ({0}, {1})", pc2.x, pc2.y);
Console.WriteLine("pc1.Equals(pc2) results in " + pc1.Equals(pc2));
Console.WriteLine("pc1 == pc2 results in " + (pc1 == pc2));
}
示例2: OnMouseDown
protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
{
int intx = arg.X;
int inty = arg.Y;
IPoint pPoints = new PointClass();
pPoints.PutCoords(intx, inty);
IActiveView activeView = ArcMap.Document.ActiveView;
pPoints = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(-100, 40);//x,y为屏幕坐标
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;
ESRI.ArcGIS.Display.IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;
pPoints=displayTransformation.ToMapPoint(-120, 40);
IMxDocument doc = ArcMap.Document;
IMap map = doc.FocusMap;
pPoints=doc.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(-100, 40);
AlterForm frm = null;
if (frm == null || frm.IsDisposed)
frm = new AlterForm(intx,inty);
frm.Show();
frm.TopMost = true;
frm.Width = 400;
frm.Height = 300;
frm.Left = 500;
}
示例3: axPageLayoutControl1_OnDoubleClick
private void axPageLayoutControl1_OnDoubleClick(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnDoubleClickEvent e)
{
if (e.button == 1)
{
//标注的修改
if (axPageLayoutControl1.CurrentTool == null) return;
if (((axPageLayoutControl1.CurrentTool) as ICommand).Name == "ControlToolsGraphicElement_SelectTool")
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(e.pageX, e.pageY);
IGraphicsContainer pGraphicsContainer = axPageLayoutControl1.PageLayout as IGraphicsContainer;
IEnumElement pEnumElement = pGraphicsContainer.LocateElements(pPoint, 10);
if (pEnumElement != null)
{
IElement pElement = pEnumElement.Next();
if (pElement is ITextElement)
{
ITextElement ptextElement = pElement as ITextElement;
MapPrint.TextSetUp textSetUp = new MapPrint.TextSetUp();
textSetUp.UpdateTextElement(ptextElement);
textSetUp.Show();
}
}
}
}
}
示例4: BuildPolygon
/// <summary>
/// 将字符串格式转化为Geometry
/// </summary>
/// <param name="geom"> 客户端传递多边形格式 1) x1,y1;x2,y2;x3,y3.......xn,yn;x1,y1;保证起始闭合 为无环
/// 2) x1,y1,flag3;x2,y2,flag3;x3,y3,flag3.......xn,yn,,flagn;
/// </param>
/// <returns></returns>
public static IPolygon BuildPolygon(string geom)
{
if (string.IsNullOrEmpty(geom) == true)
{
throw new Exception(sErroCoordinatesIsNull);
}
string[] points = geom.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
if (points != null && points.Length > 2)
{
int pointCount = points.Length;
IPolygon polygon = null;
IPoint point = null;
object missing = Type.Missing;
IGeometryCollection pGeoColl = new PolygonClass() as IGeometryCollection;
IPointCollection pPointCol = new RingClass();
for (int i = 0; i < pointCount; i++)
{
string[] pts = points[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
point = new PointClass();
double x = 0.0;
double y = 0.0;
int flag = 0;
bool bX = double.TryParse(pts[0], out x);
bool bY = double.TryParse(pts[1], out y);
bool bFlag = int.TryParse(pts[2], out flag);
if (bX && bY && bFlag)
{
pPointCol.AddPoint(point, ref missing, ref missing);
if (flag == -1 || i == (pointCount - 1))
{
pGeoColl.AddGeometry(pPointCol as IRing, ref missing, ref missing);
pPointCol = null;
break;
}
else if (flag == -2)
{
pGeoColl.AddGeometry(pPointCol as IRing, ref missing, ref missing);
pPointCol = new RingClass();
continue;
}
}
else
{
throw new Exception(sErroCoordinatesValueIllegal);
}
}
if (pPointCol.PointCount > 0)
{
pGeoColl.AddGeometry(pPointCol as IRing, ref missing, ref missing);
}
polygon = pGeoColl as IPolygon;
SimplifyGeometry(polygon);
return polygon;
}
else
{
throw new Exception(sErroCoordinatesValueIllegal);
}
}
示例5: DrawTddc
/// <summary>
/// 绘制推断断层
/// </summary>
/// <params name="title"></params>
/// <params name="faultagePointList"></params>
/// <params name="bId"></params>
/// <returns></returns>
public static bool DrawTddc(String title, List<InferFaultagePoint> faultagePointList, String bId)
{
List<IPoint> listptS = new List<IPoint>();
List<IPoint> listptX = new List<IPoint>();
foreach (var i in faultagePointList)
{
if (i.up_or_down == "上盘")
{
IPoint point = new PointClass();
point.X = i.coordinate_x;
point.Y = i.coordinate_y;
point.Z = i.coordinate_z;
listptS.Add(point);
}
else if (i.up_or_down == "下盘")
{
IPoint point = new PointClass();
point.X = i.coordinate_x;
point.Y = i.coordinate_y;
point.Z = i.coordinate_z;
listptX.Add(point);
}
}
return DrawTDDC(title, bId, listptS, listptX);
}
示例6: OnClick
protected override void OnClick()
{
IActiveView activeView = ArcMap.Document.ActiveView;
IMap map = activeView as IMap;
ILayer layer = map.get_Layer(0);
IFeatureLayer featureLayer = layer as IFeatureLayer;
IFeatureClass featureClass = featureLayer.FeatureClass;
IPoint point = new PointClass();
point.PutCoords(-117.1, 34.075); //(LONG, LAT)
IWorkspace workspace = GetWorkspace();
IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
// -------------- Perform your editing tests here ------------------
CreateFeature(featureClass, point);
//UpdateFeature(featureClass);
//DeleteFeature(featureClass);
// -----------------------------------------------------------------
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);
ArcMap.Application.CurrentTool = null;
}
示例7: Form1
public Form1()
{
if (!ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.ArcReader))
{
if (!ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop))
{
MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down.");
return;
}
}
InitializeComponent();
//IMap.ClipGeometry Property;
string filePath = @"E:\Downloads\ARCgis\United States\USA Base Map.mxd";
if (axMapControl1.CheckMxFile(filePath))
axMapControl1.LoadMxFile(filePath, Type.Missing, Type.Missing);
IPoint point = new PointClass();
point.X = -100;
point.Y = 40000;
System.Drawing.Point p = new System.Drawing.Point(101, 37);
// axMapControl1.CenterAt(point);
//IEnvelope pEnvelope = this.axMapControl1.Extent;
axMapControl1.PointToClient(p);
//pEnvelope.CenterAt(point);
//this.axMapControl1.Extent = pEnvelope;
//axMapControl1.ActiveView.ScreenDisplay.RotateMoveTo(point);
////Draw the rotated display.
//axMapControl1.ActiveView.ScreenDisplay.RotateTimer();
axMapControl1.Refresh();
}
示例8: SimplePointCursor
public SimplePointCursor(string filePath, IFields fields, int OID,
System.Array fieldMap, IEnvelope queryEnv, esriGeometryType geomType)
{
//HIGHLIGHT: 0 - Set up cursor
m_bIsFinished = false;
m_pStreamReader = new System.IO.StreamReader(filePath);
m_fields = fields;
m_iOID = OID;
m_fieldMap = fieldMap;
m_searchEnv = queryEnv;
switch (geomType)
{
case esriGeometryType.esriGeometryPolygon:
m_wkGeom = new Polygon() as IGeometry;
m_workPts = new PointClass[5];
for (int i = 0; i < m_workPts.Length; i++)
m_workPts[i] = new PointClass();
break;
case esriGeometryType.esriGeometryPolyline:
m_wkGeom = new PolylineClass() as IGeometry;
m_workPts = new PointClass[5];
for (int i = 0; i < m_workPts.Length; i++)
m_workPts[i] = new PointClass();
break;
case esriGeometryType.esriGeometryPoint:
m_wkGeom = new PointClass() as IGeometry;
break;
default: //doesn't need to set worker geometry if it is table
break;
}
//advance cursor so data is readily available
this.NextRecord();
}
示例9: cmdOK_Click
private void cmdOK_Click(object sender, EventArgs e)
{
//calc distance between points
double dbp = 0;
if (rbNOP.Checked)
dbp = m_polyline.Length / (int.Parse(txtNOP.Text) + 1);
else
dbp = int.Parse(txtDist.Text);
m_editor.StartOperation();
this.Cursor = Cursors.WaitCursor;
//create points at distance between points up to total length
for (double d = dbp; d < m_polyline.Length; d += dbp)
{
IConstructPoint contructionPoint = new PointClass();
contructionPoint.ConstructAlong(m_polyline, esriSegmentExtension.esriNoExtension,d,false);
CreatePoint(contructionPoint as IPoint);
}
//create points at start and end of sketch
if (chkEnds.Checked)
{
CreatePoint(m_polyline.FromPoint);
CreatePoint(m_polyline.ToPoint);
}
this.Cursor = Cursors.Default;
m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("CrtPtsAlongLine"));
this.Close();
}
示例10: getGlobeCoodinates
public void getGlobeCoodinates(AxGlobeControl axGlobeControl, int x, int y, out double X, out double Y, out double Z)
{
//string coordInfo = "坐标信息";
try
{
//获取点击坐标的X、Y
IPoint globePoint = new PointClass();
IGlobeDisplay globeDisplay = axGlobeControl.GlobeDisplay;
ISceneViewer sceneViewer = globeDisplay.ActiveViewer;
System.Object owner = System.Type.Missing;
System.Object object1 = System.Type.Missing;
globeDisplay.Locate(sceneViewer, x, y, false, false, out globePoint, out owner, out object1);
//coordInfo = globePoint.X.ToString("F8") + "," + globePoint.Y.ToString("F8") + "," + globePoint.Z.ToString("F4");
X = globePoint.X;
Y = globePoint.Y;
Z = globePoint.Z;
//return coordInfo;
}
catch
{
X = 0;
Y = 0;
Z = 0;
//return coordInfo;
}
}
示例11: ConstructPoint2D
public static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.X = x;
point.Y = y;
return point;
}
示例12: getGeoPoint
/// <summary>
/// 坐标系转换-----投影坐标系转WGS84
/// </summary>
/// <param name="x">x坐标</param>
/// <param name="y">y坐标</param>
/// <returns>转换后的IPoint</returns>
public static IPoint getGeoPoint(double x, double y)
{
IPoint pProjPoint = new PointClass();
pProjPoint.PutCoords(x, y);
ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
pProjPoint.SpatialReference = pSRF.CreateProjectedCoordinateSystem((int)(esriSRProjCSType.esriSRProjCS_WGS1984UTM_31N));
pProjPoint.Project(pSRF.CreateGeographicCoordinateSystem((int)(esriSRGeoCSType.esriSRGeoCS_WGS1984)));
return pProjPoint; //此时为经纬度点
}
示例13: GeographicToTile
public static IPoint GeographicToTile(double lon, double lat, int zoom)
{
// From http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#C.23
IPoint point = new PointClass();
point.X = (float)((lon + 180.0) / 360.0 * (1 << zoom));
point.Y = (float)((1.0 - Math.Log(Math.Tan(lat * Math.PI / 180.0) + 1.0 / Math.Cos(lat * Math.PI / 180.0)) / Math.PI) / 2.0 * (1 << zoom));
return point;
}
示例14: TileToWorldPos
/// <summary>
/// Returns NW corner of the tile
/// </summary>
/// <param name="tile_x"></param>
/// <param name="tile_y"></param>
/// <param name="zoom"></param>
/// <returns></returns>
public static IPoint TileToWorldPos(long tile_x, long tile_y, long zoom)
{
IPoint p = new PointClass();
double n = Math.PI - ((2.0 * Math.PI * tile_y) / Math.Pow(2.0, zoom));
p.X = (float)((tile_x / Math.Pow(2.0, zoom) * 360.0) - 180.0);
p.Y = (float)(180.0 / Math.PI * Math.Atan(Math.Sinh(n)));
return p;
}
示例15: TileToGeographic
public static IPoint TileToGeographic(int tileX, int tileY, int zoom)
{
// From http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#C.23
IPoint point = new PointClass();
double n = Math.PI - ((2.0 * Math.PI * tileY) / Math.Pow(2.0, zoom));
point.X = (float)((tileX / Math.Pow(2.0, zoom) * 360.0) - 180.0);
point.Y = (float)(180.0 / Math.PI * Math.Atan(Math.Sinh(n)));
return point;
}