POST
|
Seems like self post thread. Good old forum: http://forums.esri.com/Thread.asp?c=5&f=794&t=232476 http://forums.esri.com/Thread.asp?c=159&f=1707&t=233025&mc=5#msgid708687
... View more
12-07-2011
04:13 AM
|
0
|
0
|
224
|
POST
|
Any experience with moving hundreds objects around the screen? Which to choose, dynamic display, geoevents, can i use something like feature layer for that? Can i optimize custom symbols, optimize drawing on screen? Please any advice!
... View more
12-05-2011
12:33 AM
|
0
|
0
|
224
|
POST
|
When draw one by one, this grouped elements have delay displaying until all 500 elements are drawn. Can i make it in memory and display all object at once, not to draw one by one element? Or any other way to optimize this grouped element? Here is only added new code to GeoEvents.cs: // Add Symbology Control - axSymbologyControl1
Public class GeoEvents{
private IStyleGalleryItem m_StyleGalleryItem;
private void Form_Load(){
// make 500 elements on map
for(int i=0; i<=500; i++){
DisplayAgentLocation(agentArray[i%20]);
}
}
private void timer1_Tick(){
IGroupElement groupElement = null;
while(element != null){
// check if element from map is group element
if(element is IGroupElement){
groupElement = element as IGroupElement;
}
if(elementProperties.Name = false.TOString()){
// Point geometry for first element from grouped element
IPoint point = (IPoint)groupElement.get_Element(0).Geometry;
if(Point.IsEmpty == false){
// Calculate random point
// Move both element from group element to new location
groupElement.get_Element(0).Geometry = point;
groupElement.get_Element(1).Geometry = point;
}
}
}
}
private void DisplayAgentLocation(){
// default element replaced with this grouped element
IGraphicContainer pGraphicContainer = (IGraphicContainer)axMapControl1.ActiveView.FocusMap;
IElement ELEMENT = null;
//Element 1
IElement pElement1 = null;
pElement1 = new MarkerElementClass();
pElement1.Geometry = point;
IMarkerElement markerElement1 = (IMarkerElement)pElement1;
m_StyleGalleryItem = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbol).GetItem(43);
IMarkerSymbol markerSymbol1 = (IMarkerSymbol)m_StyleGalleryItem.Item;
markerSymbol.Size = 19;
markerelement1.Symbol = markerSymbol1;
// Element 2
IElement pElement2 = null;
IPoint pCalloutPoint = new PointClass();
pCalloutPoint.PutCoords(point.X, point.Y);
TextElementClass textElement = new TextElementClass();
textElement.Geometry = pCalloutPoint;
textElement.Text = "text";
TextSymbolClass textSymbol = new TextSymbolClass();
IFontDisp font;
font = new StdFontClass() as IFontDisp;
font.Name = "Arial";
font.Bold = true;
textSymbol.Font = font;
textSymbol.Size = 7;
IRgbColor pColor = new RgbColorClass();
pColor.Red = 0;
pColor.Blue = 0;
pColor.Green = 0;
textSymbol.Color = pColor;
textSymbol.XOffset = 13;
textSymbol.YOffset = -13;
BalloonCalloutClass callout = new BalloonCalloutClass();
callout.Style = esriBalloonCalloutStyle.esriBCSRectangle;
callout.PutMargins(2, 1, 1, 0);
IRgbColor background = new RgbColorClass();
background.Red = 200;
background.Blue = 255;
background.Green = 255;
ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
simpleFillSymbol.Color = background;
callout.Symbol = simpleFillSymbol;
textSymbol.Background = callout;
textElement.Symbol = textSymbol;
pElement2 = textElement as IElement;
// Group elements into group element
IGroupElement group = new GroupElementClass();
group.AddElement(pElement2);
group.AddElement(pElement1);
ELEMENT = (IElement)group;
IElementProperties elementProperties = (IElementProperties)ELEMENT;
elementProperties.Name = agent.Located.ToString();
elementProperties.CustomProperty = int.Parse(agent.CodeNumber);
pGraphicContainer.AddElement.AddElement(ELEMENT, 0);
}
}
Anyone?
... View more
12-01-2011
11:06 PM
|
0
|
0
|
224
|
POST
|
I have problem with moving hundreds of objects on map using GeoEvents example. When using this example with default elements which has CharacterMarkerSymbol(looks like pistol) this example works fine even with 500 elements. But when i change this element to group element which consist of symbol loaded from symbol control (maybe first symbol from Esri.ServerStyle) and other Text marker element, grouped together, displaying 500 grouped elements start to slow down. I changed only default element in DisplayAgentLocation() where add element group.AddElement(element1) and group.AddElement(element2), and edited geometry moved elements in timer1_Tick(). It seems this 2 gruoped element are to complex for displaying in number more then 100 in GeoEvents. Any advice how to speed things up ?
... View more
12-01-2011
02:04 AM
|
0
|
3
|
328
|
POST
|
I have solved this issue by grouping 3 elements with IGroupElement. If some is interesting, put group element on map through OnMouseDown event
private IStyleGalleryItem m_StyleGalleryItem:
private void MainForm_Load(object sender, EventArgs e)
{
// Symbology control should be set on windows form first
string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path;
axSymbologyControl1.LoadStyleFile(sInstall + "\\Styles\\ESRI.ServerStyle");
axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassMarkerSymbols;
}
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
try
{
IPoint point = new PointClass();
point.PutCoords(e.mapX, e.mapY);
IGraphicsContainer pGraphicsContainer = (IGraphicsContainer)axMapControl1.ActiveView.FocusMap;
// --- Element 1 ----------------------------------------------------------------
IElement pElement1 = null;
pElement1 = new MarkerElementClass();
pElement1.Geometry = point;
IMarkerElement markerElement1 = (IMarkerElement)pElement1;
m_StyleGalleryItem = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols).GetItem(7);
IMarkerSymbol markerSymbol1 = (IMarkerSymbol)m_StyleGalleryItem.Item;
markerSymbol1.Size = 25;
markerElement1.Symbol = markerSymbol1;
// --- Element 2 -----------------------------------------------------------------
IElement pElement2 = null;
IPoint pCalloutPoint = new PointClass();
pCalloutPoint.PutCoords(e.mapX, e.mapY);
TextElementClass textElement = new TextElementClass();
textElement.Geometry = pCalloutPoint;
textElement.Text = "text";
TextSymbolClass textSymbol = new TextSymbolClass();
IFontDisp font;
font = new StdFontClass() as IFontDisp;
font.Name = "Arial";
font.Bold = true;
textSymbol.Font = font;
textSymbol.Size = 7;
IRgbColor pColor = new RgbColorClass();
pColor.Red = 0;
pColor.Blue = 0;
pColor.Green = 0;
textSymbol.Color = pColor;
textSymbol.XOffset = 13;
textSymbol.YOffset = -13;
BalloonCalloutClass callout = new BalloonCalloutClass();
callout.Style = esriBalloonCalloutStyle.esriBCSRectangle;
callout.PutMargins(2, 1, 1, 0);
IRgbColor background = new RgbColorClass();
background.Red = 200;
background.Blue = 255;
background.Green = 255;
ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
simpleFillSymbol.Color = background;
callout.Symbol = simpleFillSymbol;
textSymbol.Background = callout;
textElement.Symbol = textSymbol;
pElement2 = textElement as IElement;
// --- Element 3 -----------------------------------------------------------------
IPoint p1 = new PointClass();
IPoint p2 = new PointClass();
p1 = axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
p2 = axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x - 30, e.y - 30);
IPolyline polyline = new PolylineClass();
polyline.FromPoint = p1;
polyline.ToPoint = p2;
ILineElement lineElement = new LineElementClass();
IRgbColor color = new RgbColorClass();
color.Red = 255;
color.Green = 120;
color.Blue = 100;
ISimpleLineSymbol symbol = new SimpleLineSymbolClass();
symbol.Color = color;
symbol.Width = 2;
lineElement.Symbol = symbol;
IElement pElement3 = (IElement)lineElement;
pElement3.Geometry = (IGeometry)polyline;
// Group elements into group element
IGroupElement group = new GroupElementClass();
group.AddElement(pElement2);
group.AddElement(pElement1);
group.AddElement(pElement3);
axMapControl1.ActiveView.GraphicsContainer.AddElement((IElement)group, 0);
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception exc)
{
System.Windows.Forms.MessageBox.Show(exc.Message);
}
}
... View more
09-26-2011
05:50 AM
|
0
|
0
|
199
|
POST
|
How to build custom symbols? Something like one in attachment. It consists of three independent parts. 1 is simple line, which size can change 2 is some symbol, markerSymbol... 3 is place for text, envelope or rectangle, or another symbol. Maybe could try with multilayer symbols? Any idea, but it has to be simple and optimized so graphic could update easily.
... View more
09-02-2011
05:19 AM
|
0
|
2
|
518
|
POST
|
I have solved this problem, and it works fine. Just have to expand axMapControl1_OnMouseDown event : private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e){ IElement element = new MarkerElementClass(); IPoint point = new PointClass(); point.PutCoords(e.mapX, e.mapY); element.Geometry = (IGeometry)point; IMarkerElement markerElement = (IMarkerElement)element; IMarkerSymbol markerSymbol = (IMarkerSymbol)m_StyleGalleryItem.Item; markerElement.Symbol = markerSymbol; axMapControl1.ActiveView.GraphicsContainer.AddElement(element, 0); axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriGraphics, null, null); }
... View more
08-26-2011
01:44 AM
|
0
|
0
|
223
|
POST
|
How can i put(draw) symbol from SymbolControl on map? When selected item symbol from SymbolControl, and then click on map control, selected item from symbol control didnt show. code: ... private IStyleGalleryItem m_StyleGalleryItem; private void MainForm_Load(object sender, EventArgs e){ string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; axSymbologyControl1.LoadStyleFile(sInstall + "\\Styles\\ESRI.ServerStyle"); axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassMarkerSymbol; } private void axSymbologyControl1_OnItemSelected(object sender, ISymbologyControlEvents_OnItemSelectedEvent e){ m_StyleGalleryItem = (IStyleGalleryItem)e.styleGalleryItem; } private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e){ IPoint point = new PointClass(); point.PutCoords(e.x, e.y); IElement element = (IElement)m_StyleGalleryItem; element.Geometry = point; axMapControl1.ActiveView.GraphicsContainer.AddElement(element, 0); axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriGraphics, m_StyleGalleryItem, null); } ... How can i cast m_StyleGalleryItem to IElement? Any advice! Thanks
... View more
08-24-2011
02:53 AM
|
0
|
1
|
807
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|