本文整理汇总了C#中IActiveView.PartialRefresh方法的典型用法代码示例。如果您正苦于以下问题:C# IActiveView.PartialRefresh方法的具体用法?C# IActiveView.PartialRefresh怎么用?C# IActiveView.PartialRefresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActiveView
的用法示例。
在下文中一共展示了IActiveView.PartialRefresh方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayRectangle
/// <summary>
/// The display rectangle.
/// </summary>
/// <param name="activeView">
/// The active view.
/// </param>
/// <param name="elm">
/// The elm.
/// </param>
/// <returns>
/// The <see cref="IPolygon"/>.
/// </returns>
public static IPolygon DisplayRectangle(IActiveView activeView, out IElement elm)
{
ISegmentCollection segmentCollection = new PolygonClass();
var tempEnvelope = activeView.Extent;
CapEnvelope(ref tempEnvelope);
segmentCollection.SetRectangle(tempEnvelope);
var polygon = (IPolygon)segmentCollection;
var rgbColor = VectorIndexColor();
elm = AddGraphicToMap(activeView.FocusMap, polygon, rgbColor, rgbColor);
//Best practice: Redraw only the portion of the active view that contains graphics.
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
return polygon;
}
示例2: RefreshMap
private void RefreshMap(IActiveView ActiveView, IArray Layers)
{
try
{
for (int z = 0; z <= Layers.Count - 1; z++)
{
if (Layers.get_Element(z) != null)
{
IFeatureSelection pFeatSel = (IFeatureSelection)Layers.get_Element(z);
pFeatSel.Clear();//refreshes the parcel explorer
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Layers.get_Element(z), ActiveView.Extent);
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, Layers.get_Element(z), ActiveView.Extent);
}
}
}
catch
{ }
}
示例3: drawPointToGraphicLayer
//
//
//
public static void drawPointToGraphicLayer(IActiveView pActiveView, IPoint pGeom, IMarkerSymbol pSym)
{
try
{
IGraphicsContainer iGC = pActiveView as IGraphicsContainer;
IElement pEle;
IMarkerElement pLE;
if (pGeom != null)
{
pEle = new MarkerElementClass() as IElement;
pLE = pEle as IMarkerElement;
pLE.Symbol = pSym;
pEle.Geometry = pGeom;
iGC.AddElement(pEle, 0);
}
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, pActiveView.Extent);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
示例4: drawPolyline
public static void drawPolyline(IActiveView pActiveView, IPolyline pGeom)
{
try
{
IGraphicsContainer iGC = pActiveView as IGraphicsContainer;
ILineSymbol ipLineSymbol = new CartographicLineSymbolClass();
ipLineSymbol.Width = 5;
IRgbColor pRgbColor = new RgbColorClass();
pRgbColor.Red = 255;
pRgbColor.Green = 0;
pRgbColor.Blue = 0;
ipLineSymbol.Color = pRgbColor as IColor;
IElement pEle;
ILineElement pLE;
if (pGeom != null)
{
pEle = new LineElementClass() as IElement;
pLE = pEle as ILineElement;
pLE.Symbol = ipLineSymbol;
pEle.Geometry = pGeom;
iGC.AddElement(pEle, 0);
}
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, pActiveView.Extent);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
示例5: RefreshMap
private void RefreshMap(IActiveView ActiveView, IArray ParcelLayers, IFeatureLayer PointLayer,
IFeatureLayer LineLayer, IFeatureLayer ControlLayer, IFeatureLayer LinePointLayer)
{
try
{
for (int z = 0; z <= ParcelLayers.Count - 1; z++)
{
if (ParcelLayers.get_Element(z) != null)
{
IFeatureSelection pFeatSel = (IFeatureSelection)ParcelLayers.get_Element(z);
pFeatSel.Clear();//refreshes the parcel explorer
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, ParcelLayers.get_Element(z), ActiveView.Extent);
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, ParcelLayers.get_Element(z), ActiveView.Extent);
}
}
if (PointLayer != null)
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, PointLayer, ActiveView.Extent);
if (LineLayer != null)
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, LineLayer, ActiveView.Extent);
if (ControlLayer != null)
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, ControlLayer, ActiveView.Extent);
if (LinePointLayer != null)
ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, LinePointLayer, ActiveView.Extent);
}
catch
{ }
}
示例6: DeleteElementFromGraphicContainer
/// <summary>
/// Deletes the targeted Element from the maps graphics container.
/// </summary>
/// <param name="activeView">
/// active view of the map
/// </param>
/// <param name="target">
/// element that is to be deleted.
/// </param>
public static void DeleteElementFromGraphicContainer(IActiveView activeView, IElement target)
{
// Delete element from graphics container.
var graphicsContainer = activeView.GraphicsContainer;
try
{
graphicsContainer.DeleteElement(target);
// Do a partial refresh of only the layer that has been updated in this case
// ViewGraphics.
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch
{
// We had a problem in attempting the deletion of the target element.
}
}
示例7: PartialRefresh
/// <summary>
/// Refreshes the active view.
/// </summary>
/// <param name="activeView">The active view.</param>
public static void PartialRefresh(IActiveView activeView)
{
//string methodName = MethodInfo.GetCurrentMethod().Name;
if (activeView != null)
activeView.PartialRefresh((esriViewDrawPhase.esriViewGeography | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewGraphics), null, null);
// else
// _logger.LogFormat("{0}: Null ActiveView parameter.", methodName, LogLevel.enumLogLevelWarn);
}
示例8: SelectFeature
/// <summary>
/// Selects a feature on the map.
/// </summary>
/// <param name="feature">The feature to select.</param>
/// <param name="map">The map.</param>
/// <returns>Returns true if the feature was selected, otherwise returns false.</returns>
public static bool SelectFeature(IFeature feature, IMap map, IActiveView activeView, bool isInternalSelection)
{
bool selectionSuccessful = false;
if (feature != null && map != null)
{
try
{
// Core.DeveloperSettings.IsInternalSelection = true;
ILayer layer = GetLayerForFeature(feature, map);
map.ClearSelection();
if (layer != null)
{
map.SelectFeature(layer, feature);
if (activeView != null)
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);
InvalidateMap(feature, activeView);
selectionSuccessful = true;
}
}
catch (Exception e)
{
//_logger.LogAndDisplayException(e);
}
finally
{
// Core.DeveloperSettings.IsInternalSelection = false;
}
}
return selectionSuccessful;
}
示例9: MarkFeature
/// <summary>
/// Creates an element from the given feature and adds it to the active view's graphics container.
/// </summary>
/// <param name="feature">The feature from which to create the element.</param>
/// <param name="aView">The active view.</param>
/// <param name="markerColorName">The marker color.</param>
/// <returns>Returns a graphic element.</returns>
public static IElement MarkFeature(IFeature feature, IActiveView aView, string markerColorName)
{
IElement element = null;
if (feature != null && aView != null)
{
IPolygon poly = new PolygonClass();
try
{
ITopologicalOperator topOp = feature.Shape as ITopologicalOperator;
poly.SpatialReference = feature.Shape.SpatialReference;
poly = topOp.Buffer(aView.Extent.Width * .01) as IPolygon;
if (poly.SpatialReference.Equals(aView.FocusMap.SpatialReference) == false)
poly.Project(aView.FocusMap.SpatialReference);
ISimpleFillSymbol fillSym = DisplayMap.GenerateGenericFillSymbol(markerColorName, esriSimpleFillStyle.esriSFSSolid);
fillSym.Outline = DisplayMap.GenerateGenericLineSymbol(markerColorName, 2);
element = new PolygonElementClass();
element.Geometry = poly;
((IFillShapeElement)element).Symbol = fillSym;
IGraphicsContainer gCont = aView as IGraphicsContainer;
gCont.AddElement(element, 0);
aView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, topOp.Buffer(aView.Extent.Width * .02).Envelope);
}
catch (Exception e)
{
// _logger.LogException(e);
}
}
return element;
}
示例10: DrawFanShaped
private void DrawFanShaped(double x, double y, IActiveView pActiveView)
{
double radius = this.radius;
double small_radius = this.small_radius;
double start_angle = this.start_angle;
double central_angle = this.central_angle;
if (pActiveView != null)
{
IGraphicsContainer graphicsContainer = pActiveView as IGraphicsContainer;
//画大圆
IPoint pCenterPoint = new PointClass();
pCenterPoint.PutCoords(x, y);
ICircularArc pCircularArc = new CircularArcClass();
pCircularArc.PutCoordsByAngle(pCenterPoint, start_angle * Math.PI / 180.0, central_angle * Math.PI / 180.0, radius);
IPoint pStartPoint = pCircularArc.FromPoint;
IPoint pEndPoint = pCircularArc.ToPoint;
ILine pLine1 = new LineClass();
pLine1.PutCoords(pCenterPoint, pStartPoint);
ILine pLine2 = new LineClass();
pLine2.PutCoords(pEndPoint, pCenterPoint);
ISegmentCollection pRing1 = new PolygonClass();
ISegment pSegment1 = pLine1 as ISegment;
pRing1.AddSegment(pSegment1);
ISegment pSegment2 = pCircularArc as ISegment;
pRing1.AddSegment(pSegment2);
ISegment pSegment3 = pLine2 as ISegment;
pRing1.AddSegment(pSegment3);
//小圆
ICircularArc pCircularArc1 = new CircularArcClass();
pCircularArc1.PutCoordsByAngle(pCenterPoint, start_angle * Math.PI / 180.0, central_angle * Math.PI / 180.0, small_radius);
IPoint pStartPoint1 = pCircularArc1.FromPoint;
IPoint pEndPoint1 = pCircularArc1.ToPoint;
ILine pLine3 = new LineClass();
pLine3.PutCoords(pCenterPoint, pStartPoint1);
ILine pLine4 = new LineClass();
pLine4.PutCoords(pEndPoint1, pCenterPoint);
ISegmentCollection pRing2 = new PolygonClass();
ISegment pSegment4 = pLine3 as ISegment;
pRing2.AddSegment(pSegment4);
ISegment pSegment5 = pCircularArc1 as ISegment;
pRing2.AddSegment(pSegment5);
ISegment pSegment6 = pLine4 as ISegment;
pRing2.AddSegment(pSegment6);
//简化
ITopologicalOperator pTopoLogical1 = pRing1 as ITopologicalOperator;
pTopoLogical1.Simplify();
ITopologicalOperator pTopoLogical2 = pRing2 as ITopologicalOperator;
pTopoLogical2.Simplify();
IGeometry geometry = pTopoLogical1.Difference(pTopoLogical2 as IGeometry);
//产生一个SimpleFillSymbol符号
IRgbColor rgbColor = new RgbColorClass();
rgbColor.Red = 255;
rgbColor.Green = 0;
rgbColor.Blue = 0;
ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
simpleLineSymbol.Color = rgbColor;
simpleLineSymbol.Width = 1;
ISimpleFillSymbol simpleFillSymbol;
simpleFillSymbol = new SimpleFillSymbolClass();
simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross;
//设置颜色
IRgbColor rgbcolor = new RgbColorClass();
rgbcolor.Red = 0;
rgbcolor.Green = 0;
rgbcolor.Blue = 255;
simpleFillSymbol.Color = rgbcolor as IColor;
simpleFillSymbol.Outline = simpleLineSymbol;
IFillShapeElement fillShapeElement = new PolygonElementClass();
fillShapeElement.Symbol = simpleFillSymbol;
IElement pElement = fillShapeElement as IElement;
pElement.Geometry = geometry;
graphicsContainer.AddElement(pElement, 0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
}
示例11: SelecionarFeature
/// <summary>
/// Seleciona uma feature no Mapa
/// </summary>
/// <param name="feature">Feature que deve ser selecionada</param>
///<param name="activeView">Visão de mapa em uso</param>
public static void SelecionarFeature(IFeature feature, IActiveView activeView)
{
LimparSelecoes(activeView);
esriFeatureType featType = ((IFeatureClass)feature.Table).FeatureType;
if (featType == esriFeatureType.esriFTSimpleJunction | featType == esriFeatureType.esriFTSimpleEdge | featType == esriFeatureType.esriFTSimple | featType == esriFeatureType.esriFTComplexEdge)
{
IDataset ds = feature.Table as IDataset;
string[] className = ds.Name.Split('.');
IFeatureLayer flayer = GetFeatureLayer(className[1], activeView);
if (flayer != null)
{
if (className.Length > 1)
{
activeView.FocusMap.SelectFeature(flayer, feature);
}
else
{
activeView.FocusMap.SelectFeature(flayer, feature);
}
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
if (feature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
{
IEnvelope env = activeView.Extent.Envelope;
env.CenterAt(feature.Shape as IPoint);
activeView.Extent = env;
}
}
activeView.Refresh();
}
}
示例12: LimparSelecoes
/// <summary>
/// Limpa seleções ativas no mapa em um dado momento
/// </summary>
public static void LimparSelecoes(IActiveView activeView)
{
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
activeView.FocusMap.ClearSelection();
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
示例13: AddElement
/// <summary>
/// 聚焦到目标地物
/// </summary>
/// <param name="pActiveView">地图视图</param>
/// <param name="pFtLayer">图层</param>
/// <param name="nOID">地物ID</param>
public static void AddElement(IActiveView pActiveView, IFeatureLayer pFtLayer, int nOID)
{
IFeatureClass pFtCls = pFtLayer.FeatureClass;
IFeature pFt = pFtCls.GetFeature(nOID);
if (pFt == null)
{
return;
}
IGeometry pGeo = pFt.Shape;
if (pGeo == null)
{
return;
}
IEnvelope pEnvelope = pGeo.Envelope;
IGraphicsContainer pGraphContainer = pActiveView.GraphicsContainer;
//根据拓扑错误图形的几何类型,来创建相应的element
IElement ipElement = null;
RgbColor ipColor = new RgbColor();
if (pGeo.GeometryType == esriGeometryType.esriGeometryPoint)
{
IMarkerElement ipMarkElement = new MarkerElementClass();
ipElement = (IElement)ipMarkElement;
ipElement.Geometry = pGeo;
ISimpleMarkerSymbol ipMarkerSymbol = new SimpleMarkerSymbolClass();
ipColor.Red = 255;
ipColor.Blue = 0;
ipColor.Green = 0;
ipMarkerSymbol.Color = (IColor)ipColor;
ipMarkElement.Symbol = ipMarkerSymbol;
}
else if (pGeo.GeometryType == esriGeometryType.esriGeometryPolyline)
{
ILineElement ipLineElement = new LineElementClass();
ipElement = (IElement)ipLineElement;
ipElement.Geometry = pGeo;
ISimpleLineSymbol ipLineSymbol = new SimpleLineSymbolClass();
ipColor.Red = 255;
ipColor.Blue = 0;
ipColor.Green = 0;
ipLineSymbol.Color = (IColor)ipColor;
ipLineSymbol.Width = 2.0;
ipLineElement.Symbol = ipLineSymbol;
}
else if (pGeo.GeometryType == esriGeometryType.esriGeometryPolygon)
{
IPolygonElement ipPolygonElement = new PolygonElementClass();
ipElement = (IElement)ipPolygonElement;
ipElement.Geometry = pGeo;
ISimpleFillSymbol ipFillSymbol = new SimpleFillSymbolClass();
ILineSymbol ipLineSymbol = ipFillSymbol.Outline;
ipLineSymbol.Width = 2.0;
ipColor.Red = 255;
ipColor.Blue = 0;
ipColor.Green = 0;
ipLineSymbol.Color = (IColor)ipColor;
ipFillSymbol.Outline = ipLineSymbol;
IFillShapeElement pFillElement = (IFillShapeElement)ipPolygonElement;
ipFillSymbol.Style = esriSimpleFillStyle.esriSFSHollow;
pFillElement.Symbol = ipFillSymbol;
}
pGraphContainer.DeleteAllElements();
pGraphContainer.AddElement(ipElement, 0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
pActiveView.ScreenDisplay.UpdateWindow();
}