POST
|
Ryan, I don't know if this will help at all, but I noticed in your full code listing that the parameters in the function call for Popup and PopupTemplate are reversed from their order in the require statement. - Jeff
... View more
12-10-2013
09:48 AM
|
0
|
0
|
1198
|
POST
|
Try moving the lines that follow the "queryTask.execute" statement from the "doInBackground" method to the "onPostExecute" method of your AsyncTask. Hopefully the problem is limited to the issue of needing to update the GUI from only the main thread, which is performed by onPostExecute. Your sample code is missing the onPostExecute method with a FeatureSet as the incoming parameter, something like: @Override protected void onPostExecute(final FeatureSet result) { //Get an array of graphics of the query result FeatureSet Graphic[] resultGraphic = result.getGraphics(); View popupView = createPopupView(resultGraphic[0]); Map_view.getCallout().show(point, popupView); } I currently cannot verify what is going on in the PopupInWebmapForViewing sample as my machine is throwing errors - hopefully this will gain you some progress.
... View more
05-23-2013
01:41 PM
|
0
|
0
|
237
|
POST
|
I was working with the GeometryEditor sample for Android and did not like that I could not see what I was adding: new Point features would not draw until saved to the server; polygons and lines would begin to draw only after the 2 nd vertex was added. What I found within the code (GeometryEditor.java) was that there were 2 GraphicsLayer instances being used: graphicsLayer - this is the culprit, is not drawing its content graphicsLayerEditing - this is the GOOD one I got things to draw by using a single GraphicsLayer: graphicsLayerEditing. What was happening: User-added vertices were being added to both GraphicsLayers. The graphicsLayer instance was attempting to draw the last vertex entered ??? in the case of Point features the only vertex entered. The GraphicsLayer never drew its content, due to the way it was being instantiated prior to map initialization. (There were actually 2 initializations in the onCreate method: 1 prior to, and 1 after map initialization). What I did: Below are my modifications to the drawVertices method. (I changed the color of the point/end-point to blue to improve my validation, disabled use of the graphicsLayer instance, changed/added comments). private void drawVertices() {
int index;
// draw vertices
index = 0;
if(graphicsLayerEditing == null){
graphicsLayerEditing = new GraphicsLayer();
mapView.addLayer(graphicsLayerEditing);
}
for (Point pt : points) {
if (vertexselected && index == insertingindex){
// Draw only the SELECTED vertex
Graphic graphic = new Graphic(pt,new SimpleMarkerSymbol(Color.RED, 20,
SimpleMarkerSymbol.STYLE.CIRCLE));
Log.i(TAG, "Add (selected) Graphic vertex: " + index);
graphicsLayerEditing.addGraphic(graphic);
}
else if (index == points.size() - 1 && !midpointselected && !vertexselected)
{
// This draws either the last vertex in a line/polygon or Point features
Graphic graphic = new Graphic(pt,new SimpleMarkerSymbol(Color.BLUE, 20,
SimpleMarkerSymbol.STYLE.CIRCLE));
// int id = graphicsLayer.addGraphic(graphic); // original version
// If INSTEAD the other graphics layer is added to, you can see added points for Point features!
// Also will draw the end-point when adding lines
int id = graphicsLayerEditing.addGraphic(graphic); // the fix
//Log.d(TAG, "Add Graphic mid point: "+ pt.getX()+" "+pt.getY()+" id = "+id);
Log.i(TAG,"Add Point or line end vertex: " + index);
}
else{
// This is the most common case when adding lines/polygons for n=0 to n= points.size() - 2,
// draws all but the last vertex in a line
Graphic graphic = new Graphic(pt,new SimpleMarkerSymbol(Color.BLACK, 20,
SimpleMarkerSymbol.STYLE.CIRCLE));
Log.i(TAG, "Add Graphic point num: " + index);
graphicsLayerEditing.addGraphic(graphic);
}
index++;
}
} This also could have been solved by only instantiating the graphicsLayer instance once, after the map status was initialized. It would then be drawing lines and polygons from 2 GraphicsLayer instances ??? I liked the simplicity of keeping a single feature in a single GraphicsLayer instance.
... View more
05-07-2013
02:10 PM
|
0
|
1
|
2008
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|