POST
|
Hi everyone, I am studying in ArcEngine, and now I have one problem with Geometric Network here. Imaging that I have an Enum of NetEID (IEnumNetEID)type EDGE want to draw to screen. Then I use IScreenDisplay draw this Enum to screen base on Flow of each Edge. Code: private void ShowStatusNetEID()
{
INetwork m_Network = m_GeometricNetwork.Network;
IUtilityNetworkGEN m_UtilityNetWorkGEN = m_Network as IUtilityNetworkGEN;
IEnumNetEID m_EnumNetEID = m_Network.CreateNetBrowser(esriElementType.esriETEdge);
m_EnumNetEID.Reset();
int EdgeEID = m_EnumNetEID.Next();
#region Color presets
IRgbColor BlueColor = new RgbColorClass();
//Blue
BlueColor.Red = 0;
BlueColor.Green = 0;
BlueColor.Blue = 200;
IRgbColor GreenColor = new RgbColorClass();
//Green
GreenColor.Red = 0;
GreenColor.Green = 200;
GreenColor.Blue = 0;
IRgbColor RedColor = new RgbColorClass();
//Red
RedColor.Red = 200;
RedColor.Green = 0;
RedColor.Blue = 0;
#endregion
#region m_GreenLineSymbol : LineSymbol with Green Color
ILineSymbol m_GreenLineSymbol = new SimpleLineSymbolClass();
m_GreenLineSymbol.Color = GreenColor;
m_GreenLineSymbol.Width = 2;
#endregion
#region m_RedLineSymbol : LineSymbol with Red Color
ILineSymbol m_RedLineSymbol = new SimpleLineSymbolClass();
m_RedLineSymbol.Color = RedColor;
m_RedLineSymbol.Width = 2;
#endregion
#region m_BlueLineSymbol : LineSymbol with Blue Color
ILineSymbol m_BlueLineSymbol = new SimpleLineSymbolClass();
m_BlueLineSymbol.Color = BlueColor;
m_BlueLineSymbol.Width = 2;
#endregion
IScreenDisplay m_SD = axMapControl1.ActiveView.ScreenDisplay;
//Draw Status on each Egde EID
while (EdgeEID != null)
{
if (EdgeEID == 0)
{
break;
}
//Green line for Edge has Flow
if (m_UtilityNetWorkGEN.GetFlowDirection(EdgeEID) == esriFlowDirection.esriFDAgainstFlow || m_UtilityNetWorkGEN.GetFlowDirection(EdgeEID) == esriFlowDirection.esriFDWithFlow)
{
IGeometry m_Geometry = m_GeometricNetwork.get_GeometryForEdgeEID(EdgeEID);
m_SD.SetSymbol(m_GreenLineSymbol as ISymbol);
m_SD.DrawPolyline(m_Geometry);
m_SD.FinishDrawing();
}
//Red Line for Edge that Uninitialize flow
else if (m_UtilityNetWorkGEN.GetFlowDirection(EdgeEID) == esriFlowDirection.esriFDUninitialized)
{
IGeometry m_Geometry = m_GeometricNetwork.get_GeometryForEdgeEID(EdgeEID);
m_SD.StartDrawing(m_SD.hDC, GN_CacheID);
m_SD.SetSymbol(m_RedLineSymbol as ISymbol);
m_SD.DrawPolyline(m_Geometry);
m_SD.FinishDrawing();
}
//Blue line for Edge that Indeterminate flow
else if (m_UtilityNetWorkGEN.GetFlowDirection(EdgeEID) == esriFlowDirection.esriFDIndeterminate)
{
IGeometry m_Geometry = m_GeometricNetwork.get_GeometryForEdgeEID(EdgeEID);
m_SD.StartDrawing(m_SD.hDC, GN_CacheID);
m_SD.SetSymbol(m_BlueLineSymbol as ISymbol);
m_SD.DrawPolyline(m_Geometry);
m_SD.FinishDrawing();
}
EdgeEID = m_EnumNetEID.Next();
}
} This code working good and fast on an Network within 1000 edges. But with a large network (e.g 3000 edges) it draw very slow. So can anyone help me some issue here: 1.How to Draw just draw what is invisible on map( i.e data layer not check on TOC or inside the Network but not load on map.) 2. When Panning or Zooming, how can we just draw the specific screen-frame that show on the ScreenDisplay( not drawing all stuff from Cache to screen, just the area that show up on ScreenDisplay) 3.Can we Drawing using MultiThread for faster.
... View more
12-29-2012
03:08 AM
|
0
|
1
|
1266
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|