本文整理汇总了C#中EnvelopeClass.CenterAt方法的典型用法代码示例。如果您正苦于以下问题:C# EnvelopeClass.CenterAt方法的具体用法?C# EnvelopeClass.CenterAt怎么用?C# EnvelopeClass.CenterAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnvelopeClass
的用法示例。
在下文中一共展示了EnvelopeClass.CenterAt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ccc
private void ccc(IPoint p)
{
IEnvelope pEnvelope = new EnvelopeClass();
pEnvelope.SetEmpty();
pEnvelope = pAxMapControl.Extent;
pEnvelope.CenterAt(p);
pAxMapControl.Extent = pEnvelope.Envelope;
pAxMapControl.Refresh();
}
示例2: AddPPGeocodedPoint
internal void AddPPGeocodedPoint(double lat, double lng)
{
// Set the coordinate system of the data frame.
ArcMap.Document.ActiveView.FocusMap.SpatialReference = DefineGCS();
ArcMap.Document.ActiveView.Refresh();
IPoint iPoint = new PointClass();
// Set the coordinate system of your point to match your data frame
iPoint.SpatialReference = DefineGCS();
iPoint.X = lng;
iPoint.Y = lat;
IMap map = ArcMap.Document.ActiveView as IMap;
IGraphicsContainer graphicsContainer = (IGraphicsContainer)map; // Explicit Cast
IElement element = null;
// set the point color
IColor pointColor = new RgbColor();
//pointColor.RGB = 255255255;
pointColor.RGB = 255000000;
// Marker symbols
ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
simpleMarkerSymbol.Color = pointColor;
simpleMarkerSymbol.Outline = true;
simpleMarkerSymbol.OutlineColor = pointColor;
simpleMarkerSymbol.Size = 10;
simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
// Marker element
IMarkerElement markerElement = new MarkerElementClass();
markerElement.Symbol = simpleMarkerSymbol;
markerElement.Symbol.Color = pointColor;
element = (IElement)markerElement; // Explicit Cast
// set the element name
IElementProperties3 elemProperties = element as IElementProperties3;
elemProperties.Name = string.Concat(lng, " ,", lat);
elemProperties.AnchorPoint = esriAnchorPointEnum.esriCenterPoint;
// Add the element to a graphics container and refresh the ActiveView
if (!(element == null))
{
element.Geometry = iPoint;
graphicsContainer.AddElement(element, 0);
IEnvelope envelope = new EnvelopeClass();
envelope = ArcMap.Document.ActiveView.Extent;
envelope.CenterAt(iPoint);
//ArcMap.Document.ActiveView.Extent = envelope;
//map.MapScale = 2400;
map.MapScale = 5000;
ArcMap.Document.ActiveView.Refresh();
}
}
示例3: toolStripButton1_Click
private void toolStripButton1_Click(object sender, EventArgs e)
{
IEnvelope pEnvelope = new EnvelopeClass();
IPoint pPoint = new PointClass();
pPoint.PutCoords(Convert.ToDouble(txtlong.Text), Convert.ToDouble(txtlat.Text));
pEnvelope = pAxMapControl.Extent;
pEnvelope.CenterAt(pPoint);
pAxMapControl.Extent = pEnvelope.Envelope;
pAxMapControl.FlashShape(pPoint as IGeometry);
//ccc(pPoint);
//ddd(pPoint);
}
示例4: OnMouseDown
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
IMap map;
IPoint clickedPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
//If ActiveView is a PageLayout
if (m_hookHelper.ActiveView is IPageLayout)
{
//See whether the mouse has been clicked over a Map in the PageLayout
map = m_hookHelper.ActiveView.HitTestMap(clickedPoint);
//If mouse click isn't over a Map exit
if (map == null)
return;
//Ensure the Map is the FocusMap
if ((!object.ReferenceEquals(map, m_hookHelper.FocusMap)))
{
m_hookHelper.ActiveView.FocusMap = map;
m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
//Still need to convert the clickedPoint into map units using the map's IActiveView
clickedPoint = ((IActiveView)map).ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
}
else //Or ActiveView is a Map
{
map = m_hookHelper.FocusMap;
}
IActiveView activeView = (IActiveView)map;
IRubberBand rubberEnv = new RubberEnvelopeClass();
IGeometry geom = rubberEnv.TrackNew(activeView.ScreenDisplay, null);
IArea area = (IArea)geom;
//Extra logic to cater for the situation where the user simply clicks a point on the map
//or where envelope is so small area is zero
if ((geom.IsEmpty == true) || (area.Area == 0))
{
//create a new envelope
IEnvelope tempEnv = new EnvelopeClass();
//create a small rectangle
ESRI.ArcGIS.esriSystem.tagRECT RECT = new tagRECT();
RECT.bottom = 0;
RECT.left = 0;
RECT.right = 5;
RECT.top = 5;
//transform rectangle into map units and apply to the tempEnv envelope
IDisplayTransformation dispTrans = activeView.ScreenDisplay.DisplayTransformation;
dispTrans.TransformRect(tempEnv,ref RECT, 4); //4 = esriDisplayTransformationEnum.esriTransformToMap)
tempEnv.CenterAt(clickedPoint);
geom = (IGeometry)tempEnv;
}
//Set the spatial reference of the search geometry to that of the Map
ISpatialReference spatialReference = map.SpatialReference;
geom.SpatialReference = spatialReference;
map.SelectByShape(geom, null, false);
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);
}
示例5: button1_Click
//定位
private void button1_Click(object sender, EventArgs e)
{
IEnvelope pEnvelope = new EnvelopeClass();
IPoint pPoint = new PointClass();
//调用GetProject2方法经纬度转换成米
pPoint = GetProject2(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));
//axMapControl.MapUnits = esriUnits.esriDecimalDegrees;
//axMapControl.MapUnits = esriUnits.esriMeters; //米
// esriUnits mapUnits = axMapControl.MapUnits;
//axMapControl.MapUnits = esriUnits.esriDecimalDegrees;
//pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));//该句中的txtlong,txtlat是输入经纬值的TextBox
//pPoint.X = Convert.ToDouble(textBox1.Text);
//pPoint.Y = Convert.ToDouble(textBox2.Text);
pEnvelope = axMapControl.Extent;
pEnvelope.CenterAt(pPoint);
axMapControl.Extent = pEnvelope.Envelope;//前一段代码实现平移
axMapControl.ActiveView.ScreenDisplay.UpdateWindow();
axMapControl.FlashShape(pPoint as IGeometry);//此句实现闪烁(效果没有ArcMap中好, )
//axMapControl.ActiveView.Extent = pEnvelope;
//showAnnotationByScale();
}
示例6: GetEnvlope
public static IEnvelope GetEnvlope(IActiveView activeView, IPoint queryPoint, double envlopeDistance)
{
IEnvelope envelope = new EnvelopeClass();
envelope.CenterAt(queryPoint);
envelope.Width = 2 * envlopeDistance;
envelope.Height = 2 * envlopeDistance;
return envelope;
}
示例7: button1_Click
//定位
private void button1_Click(object sender, EventArgs e)
{
//ESRI.ArcGIS.esriSystem.IUnitConverter unitConverter = (ESRI.ArcGIS.esriSystem.IUnitConverter)ServerContext.CreateObject("esriSystem.UnitConverter");
//project raster
//IUnitConverter iu = new esriUnits();
IUnitConverter unitConverter = new UnitConverterClass();
double dFittedBoundsWidthInches = unitConverter.ConvertUnits(-100, esriUnits.esriDecimalDegrees, esriUnits.esriMeters)/100;
double dFittedBoundsWidthInchesy = unitConverter.ConvertUnits(40, esriUnits.esriDecimalDegrees, esriUnits.esriMeters)/100;
//ui.ConvertUnits(10, esriUnits.esriMeters, esriUnits.esriMeters);
//IPoint pPoint = new PointClass();
//pPoint.X = -1000;
//pPoint.Y = -1000;
//IGeometry pGeometry;
//pGeometry = (IGeometry)pPoint;
//IMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass();
//axMapControl.FlashShape(pGeometry, 4, 100, pMarkerSymbol);
IEnvelope pEnvelope = new EnvelopeClass();
IPoint pPoint = new PointClass();
//axMapControl.MapUnits = esriUnits.esriDecimalDegrees;
//axMapControl.MapUnits = esriUnits.esriMeters; //米
// esriUnits mapUnits = axMapControl.MapUnits;
//axMapControl.MapUnits = esriUnits.esriDecimalDegrees;
//pPoint.PutCoords(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text));//该句中的txtlong,txtlat是输入经纬值的TextBox
pPoint.X = Convert.ToDouble(textBox1.Text);
pPoint.Y = Convert.ToDouble(textBox2.Text);
pEnvelope = axMapControl.Extent;
pEnvelope.CenterAt(pPoint);
axMapControl.Extent = pEnvelope.Envelope;//前一段代码实现平移
axMapControl.ActiveView.ScreenDisplay.UpdateWindow();
axMapControl.FlashShape(pPoint as IGeometry);//此句实现闪烁(效果没有ArcMap中好, )
//axMapControl.ActiveView.Extent = pEnvelope;
//showAnnotationByScale();
}
示例8: toolStripButton2_Click
private void toolStripButton2_Click(object sender, EventArgs e)
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(Convert.ToDouble(txtlong.Text), Convert.ToDouble(txtlat.Text));
IEnvelope pEnvelope = new EnvelopeClass();
pEnvelope = pAxMapControl.Extent;
//pEnvelope.Expand(10, -10, true);
pEnvelope.Width = 20;
pEnvelope.Height = 15;
pEnvelope.CenterAt(pPoint);
pAxMapControl.Extent = pEnvelope.Envelope;
pAxMapControl.FlashShape(pPoint as IGeometry);
}
示例9: ConstructViewEnvAtPoint
private IEnvelope ConstructViewEnvAtPoint(IPoint pt, double size)
{
IEnvelope theEnv = new EnvelopeClass();
pt.Project(this.BCAlbersSpatialReference);
theEnv.LowerLeft = pt;
theEnv.Width = size;
theEnv.Height = size;
theEnv.Project(this.BCAlbersSpatialReference);
theEnv.CenterAt(pt);
return theEnv;
}