POST
|
what i am trying to do is draw a line as a molelinesymbol the first point i am able to pick from the mouse click but how to pick the second point? I am using Joptionpane showinput dialog, but as soon as that dialog box appears, the application will just hung up and never respond again.. I am putting the complete code in the text file attached and the AddLine function below..looking forward to your help guys.. I am really stuck :confused:.. private void AddLine(IPoint location) [INDENT]{ try { [INDENT]// create the symbol using a default symbol ID code (fix task line) IMoleSymbol moleSymbol = new MoleLineSymbol(); moleSymbol.setSymbolID ("GUTPF---------X"); moleSymbol.setTextLabels (getLabels()); moleSymbol.setTextSize (2.0); // override the default line color and width - these settings are optional //ILineSymbol lineSymbol = (ILineSymbol) moleSymbol; //lineSymbol.setColor (getRandomColor()); //lineSymbol.setWidth (dRandom(1, 5)); // create a new line geometry for the symbol - this symbol requires two points IPointCollection pointCollection = new Polyline(); // place the first endpoint of the line somewhere inside the current map extent IActiveView activeView = m_mapWindow.getMapBean().getActiveView(); Envelope ext = (Envelope) activeView.getExtent(); double lat = dRandom (ext.getYMin(), ext.getYMax()); double lon = dRandom (ext.getXMin(), ext.getXMax()); pointCollection.addPoint (location, null, null); // here i am trying to take Lat-Long from inputdialog lat=Double.parseDouble(JOptionPane.showInputDialog("Latitude","")); lon=Double.parseDouble(JOptionPane.showInputDialog("Longitude","")); [INDENT][/INDENT]pointCollection.addPoint (createPoint(lon, lat),null,null); // set up the graphic element with the random geometry ILineElement lineElement = new LineElement(); lineElement.setSymbol ((ILineSymbol)moleSymbol); IElement element = (IElement) lineElement; element.setGeometry ((IGeometry)pointCollection); // add the new element to the map and update the user interface activeView.getGraphicsContainer().addElement (element, 0); activeView.partialRefresh (esriViewGraphics, null, null); ++m_unitCount; updateTitle();[/INDENT] } catch ( Exception e ) { e.printStackTrace(); }[/INDENT] }
... View more
08-08-2012
02:49 AM
|
0
|
1
|
2030
|
POST
|
I have to create a circle through a feature class, so that it can be added to the table of contents as a layer after creation and i can turn it on and off as required and also perform some analysis operations. I have already created a circle as graphic but i don't know how to add it as layer, i have added it to the map as a element. I know how to connect to work-space and feature class, put some values in it or delete some but can't figure out the way to draw a polygon(Circle) and add it as a layer. So plz help me out, Thanks in advance Apoorva Gora
... View more
03-16-2012
02:05 AM
|
0
|
2
|
576
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|