Select to view content in your preferred language

graphic not visible for custom symbology draw toolbar

758
2
02-14-2012 06:34 AM
NadirHussain
Frequent Contributor
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
    width="290" height="300" creationComplete="titlewindow1_creationCompleteHandler(event)">
  
<s:layout>
  <s:VerticalLayout/>
</s:layout>

<fx:Script>
  <![CDATA[
        
   private var lastDrawnGraphic:Graphic;
  
   private var graphicsLayer:GraphicsLayer;
   [Bindable]
   public var map:Map
  
   [Bindable]
   public var strPointStyledp:ArrayList=new ArrayList(['Circle','Crosss','Diomand','Square','Triangle','X']);
  
   [Bindable]
   public var strLineStyledp:ArrayList=new ArrayList(['Solid','Dash','Dot','Dash Dot','Dash Dot Dot']);
  
   [Bindable]
   public var strRectStyledp:ArrayList=new ArrayList(['Solid','Backword Diagonal','Cross','Forward Diagonal','Horizontal','Vertical']);
  
   [Bindable]
   private var configDistancedp:ArrayList = new ArrayList([
    {name:'Kilometers',abbr:'km',conversion:0.001},
    {name:"Miles",abbr:"mi",conversion:0.000621},
    {name:"Meters",abbr:"m",conversion:1},
    {name:"Feet",abbr:"ft",conversion:3.2808},
    {name:"Yards",abbr:"yd",conversion:1.0936133}
   ]);
  
  
  
   [Bindable]
   private var configAreadp:ArrayList = new ArrayList([
    {name:"Acers",aAbbr:"ac",aConversion:0.00024710538147},
    {name:"Hectares",aAbbr:"ha",aConversion:0.0001},
    {name:"Square feet",aAbbr:"sq ft",aConversion:10.763910417},
    {name:"Square kilometer",aAbbr:"sq km",aConversion:0.000001},
    {name:"Square miles",abbr:"sq mi",aConversion:1},
    {name:"Square meters",aAbbr:"sq m",aConversion:0.000001},
    {name:"Square Yards",aAbbr:"sq yd",aConversion:1.19599005}
   ]);
  
   public var sms:SimpleMarkerSymbol;
   //public var sls:SimpleLineSymbol;
    
  
  
  
   protected function buttonbar1_clickHandler(event:MouseEvent):void
   {
        try
    {
    
    
     var drawType:String = event.currentTarget.dataProvider[event.currentTarget.selectedIndex].action;
      if(drawType=="Point")
        {
      
        myViewStack.selectedChild=PointStack as INavigatorContent;
         myDrawTool.activate(DrawTool.MAPPOINT);
            
        }
         
    }//try
      catch(Err:Error)
      {
       Alert.show(Err.message);
      }
   
   }
  
  
   private function map_drawEndHandler(event:DrawEvent):void
   {
    try
    {
    
     var geom:Geometry = event.graphic.geometry
     lastDrawnGraphic =new Graphic(geom);
     lastDrawnGraphic.autoMoveToTop = false;
     myGraphicsLayer=new GraphicsLayer();
    
     switch (geom.type)
     {
      case Geometry.MAPPOINT:
      {
      
                    var hexColorString:String=cp.selectedColor.toString(16);
       while( hexColorString.length < 6 )
       {
        hexColorString = '0' + hexColorString;
       }
              var hexoutLineColorString:String=PointoutLineClr.selectedColor.toString(16);
       while(hexoutLineColorString.length < 6 )
       {
        hexoutLineColorString = '0' + hexoutLineColorString;
       }
       sms=new SimpleMarkerSymbol();
       sms.style=cmbStyle.selectedItem;
       sms.size=PointSizeStepper.value;
       sms.color=0x33ff55;
       sms.alpha=PointAlphaStepper.value;
       sms.outline=new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,0x334455,05,5);
      
       myDrawTool.graphicsLayer=myGraphicsLayer;
       lastDrawnGraphic.symbol=sms;
        myGraphicsLayer.add(lastDrawnGraphic);
        myMap.addLayer(myGraphicsLayer);
        
       }
           }
    }
    catch(Err:Error)
    {
    
    }
   }
  
     
   protected function polygonChkMeasureUnits_clickHandler(event:MouseEvent):void
   {
    var chk:CheckBox;
    chk=event.currentTarget as CheckBox;
    if (chk.selected)
    {
     polygonDu.visible=true;
     polygonDistUnits.visible=true;
     polygonAu.visible=true;
     polygonAreaUnits.visible=true;
    }
    else
    {
     polygonDu.visible=false;
     polygonDistUnits.visible=false;
     polygonAu.visible=false;
     polygonAreaUnits.visible=false;
    }
   }
  
  
   protected function titlewindow1_creationCompleteHandler(event:FlexEvent):void
   {
    // TODO Auto-generated method stub
    myViewStack.selectedChild=initStack as INavigatorContent
   
       
   }
  
  
 
  
  ]]>
</fx:Script>

<fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
  <!--
  <esri:DrawTool id="myDrawTool" map="{myMap}" showDrawTips="false" drawEnd="map_drawEndHandler(event)"   />
 
   
  <esri:Map id="myMap" level="3" wrapAround180="true">
  </esri:Map>
 

</fx:Declarations>
<s:BorderContainer width="100%" height="32">
  <s:layout>
   <s:HorizontalLayout/>
  </s:layout>
  <s:ButtonBar id="buttonbar1" width="100%" height="100%" click="buttonbar1_clickHandler(event)" skinClass="myComponents.buttonbarskin">
   <!--valueCommit="if (buttonbar1.selectedIndex == -1) { drawToolbar.deactivate() }"> -->
   <s:ArrayCollection>
    <fx:Object action="Point"
          icon="@Embed('assets/images/i_draw_point.png')"
          label=""
          visible="true"
          toolTip="Point"/>
    
     <fx:Object action="Line"
          icon="@Embed('assets/images/i_draw_line.png')"
          label=""
          visible="true"
          toolTip="Line"/>
    
     <fx:Object action="Free Line"
          icon="@Embed('assets/images/i_draw_freeline.png')"
          label=""
          visible="true"
          toolTip="Free Hand Line"/>
    
     <fx:Object action="Rectangle"
          icon="@Embed('assets/images/i_draw_rect.png')"
          label=""
          visible="true"
          toolTip="Rectangle"/>
     <fx:Object action="Circle"
          icon="@Embed('assets/images/i_draw_circle.png')"
          label=""
          visible="true"
          toolTip="Circle"/>
    
     <fx:Object action="Ellipse"
          icon="@Embed('assets/images/i_draw_ellipse.png')"
          label=""
          visible="true"
          toolTip="Ellipse"/>
    
     <fx:Object action="Polygon"
          icon="@Embed('assets/images/i_draw_poly.png')"
          label=""
          visible="true"
          toolTip="Polygon"/>
    
     <fx:Object action="Free hand Polygon"
          icon="@Embed('assets/images/i_draw_freepoly.png')"
          label=""
          visible="true"
          toolTip="Free Hand Polygon"/>
    
     <fx:Object action="Text"
          icon="@Embed('assets/images/i_draw_text.png')"
          label=""
          visible="true"
          toolTip="Text"/>
   </s:ArrayCollection>
  </s:ButtonBar>
</s:BorderContainer>
<s:BorderContainer width="100%" height="229">
  <mx:ViewStack id="myViewStack" width="287" height="227" >
   <s:NavigatorContent id="initStack">
    <s:layout>
     <s:FormItemLayout/>
    </s:layout>
   
   </s:NavigatorContent>
     </mx:ViewStack>
</s:BorderContainer>
</s:TitleWindow>
//////////////////////////
the above code is my custom drawing component.if i dont set my custom symbol a black point visible on my map after selecting point from my draw toolbar.if set custom symbology dont visible anything.pls help.waiting for reply.

Thanks in advance.
Tags (2)
0 Kudos
2 Replies
N_Young
Deactivated User
Not quite sure if this is what you were asking -

I  had the issue of not being able to load and view the icons on the draw toolbar.  If that is your problem, you need to have a src/assets folder in your flex project with the icon images inside it.
Here is the help I got: http://forums.arcgis.com/threads/50923-Icons-for-quot-select-parcels-quot
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nadir,

   I don't see anywhere in your code that you are declaring the cmbStyle combobox or dropdownlist. I also don't see where you are using your strPointStyledp and other arraylists.
0 Kudos