How to reset to "default" SimpleMarkerSymbol?

2699
1
Jump to solution
05-27-2013 01:56 PM
GakuminKato
New Contributor III
Hello everyone,

I have a question regarding SimpleMarkerSymbol.
As you may know, if codes does not specify SimpleMarkerSymbol for selected ArcGISFeatureLayer, then the code picks up default SimpleMarkerSymbol, which looks like the same selection highlights of ArcMap (please see the attached jpg). I like this SimpleMarkerSymbol. This shows an original symbology of Feature Service and highlight only its outline.

My question is that how I can set this default setting once AFTER I set a different SimpleMarkerSymbol for the same ArcGISFeatureLayer.
(This could be reset or clear setting of another setting of SimpleMarkerSymbol?)
Actually, my goal is that when points are selected (queried), I want to show an original symbology of Feature Service with highlighting its outline. (The attached jpg exactly show what I want to do. Again, this is done by "default" setting for SimpleMarkerSymbol ). So, as long as I can achieve my objective, I do not need to stick to the default setting.

Let me explain my workflow;
STEP 1. Query with attribute, and select ArcGISFeatureLayer of "MODE.SELECTION", and show only selected results on map with default SimpleMarkerSymbol (Here I do not specify SimpleMarkerSymbol. this works fine as I shown with attached jpg)
STEP 2. Set SimpleMarkerSymbol for setOnSingleTapListener (spatial query) as transparency point marker. And query on the same ArcGISFeatureLayer. (this works fine. Intention here is I want to keep unrelated points hidden when selected with this single tap)
STEP 3. After query of above 2, Re-set SimpleMarkerSymbol back to Default, as program remember setting of 2 above (I cannot do this!)

If I could know how exactly do same setting SimpleMarkerSymbol as defaut one, I think I can reproduce the setting at step 3.
But, I could not figure out how and parameters for default.
Another possibility would be that I could clear setting of SimpleMarkerSymbol of step 2 somehow at step3? Again, but, I do not know how... Or, do I need completely new approaches to achieve what I want to do??

Any helps, comments, and thoughts, would be appreciated...
Thanks in advance,
Gakumin

@Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  //Feature layer service
  //Read Feature Layer first, but invisible with no "SELECTION"
  featureLayer = new ArcGISFeatureLayer(this
    .getResources().getString(R.string.featurelayer_url),
    ArcGISFeatureLayer.MODE.SELECTION);
               //Here, I do not specify SimpleMarkerSymbol as I want to use default one. [STEP1]
               //query featureLayer  with parameter
   featureLayer.selectFeatures(query_fl, ArcGISFeatureLayer.SELECTION_METHOD.NEW,callback); 
   mMapView.addLayer(featureLayer);
                // start default tap actions
  // singleTap on map causes an Identify
  setDefaultTapActions();
   
  } 
public void setDefaultTapActions(){
  mMapView.setOnSingleTapListener(new OnSingleTapListener() {
@Override
   public void onSingleTap(float x, float y) {
    ......
                    //set symbol for selected featureLayer for Default Single Tap [Transparent]: [STEP2]
    SimpleMarkerSymbol SelectionSymbol = new SimpleMarkerSymbol(Color.TRANSPARENT, 6,
      SimpleMarkerSymbol.STYLE.CIRCLE);
    featureLayer.setSelectionSymbol(SelectionSymbol);
featureLayer.selectFeatures(query, ArcGISFeatureLayer.SELECTION_METHOD.NEW,
      new CallbackListener<FeatureSet>(){
     
       //@Override
       //handle any errors
       public void onError(Throwable e) {
        Log.d(TAG, "Select Features Error"
        + e.getLocalizedMessage());
       }
       
       //@Override
       //
       public void onCallback(FeatureSet queryResults) {
        if(queryResults.getGraphics().length > 0){
         
     //show the points again
     //execute the second query with the OwnerID
     Query query_fl_again = new Query();
                                        query_fl_again. ......
        
     //clear selection once
     featureLayer.clear();

//     set symbol for selected featureLayer [STEP3]
     SimpleMarkerSymbol SelectionSymbol = new SimpleMarkerSymbol(Color.TRANSPARENT, 6,
     SimpleMarkerSymbol.STYLE.CIRCLE);

            SimpleLineSymbol SlectionOutline = new SimpleLineSymbol(Color.CYAN, 2, 
            SimpleLineSymbol.STYLE.SOLID);
     SelectionSymbol.setOutline(SlectionOutline);
     featureLayer.setSelectionSymbol(SlectionOutline);
          
         featureLayer.selectFeatures(query_fl_again, ArcGISFeatureLayer.SELECTION_METHOD.NEW,callback); 
     mMapView.addLayer(featureLayer);

     return;
     }
0 Kudos
1 Solution

Accepted Solutions
GakuminKato
New Contributor III
Hi all,

I have found workaround for this.

The problem was I could not use default setting for SimpleMarkerSymbol after I set another setting for the same featureLayer.

First, I cleared selection for ArcGISfeaturelayer. Then I re-added the same featurelayer without defining SimpleMarkerSymbol. Then I could use default setting again!!

Thank you,
Gakumin

View solution in original post

0 Kudos
1 Reply
GakuminKato
New Contributor III
Hi all,

I have found workaround for this.

The problem was I could not use default setting for SimpleMarkerSymbol after I set another setting for the same featureLayer.

First, I cleared selection for ArcGISfeaturelayer. Then I re-added the same featurelayer without defining SimpleMarkerSymbol. Then I could use default setting again!!

Thank you,
Gakumin
0 Kudos