<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Append or merge or move or copy graphic(s) or featureset(s) or array(s) or ? in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/append-or-merge-or-move-or-copy-graphic-s-or/m-p/28977#M676</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have set up a clip and ship geoprocessing service.&amp;nbsp; The way it works is the user checks a box for each layer they want to download, and then they draw a single polygon or multiple polygons.&amp;nbsp; After each polygon is drawn the resulting graphic is pushed to an array, and then added to a graphicsLayer.&amp;nbsp; Finally when the user pushes the a button, the array of graphics is passed to a function that creates a FeatureSet from it and then sends it on to the geoprocessing service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Independently of this code, I have implemented code for shapefile overlay which ultimately takes a zipfile containing all the files associated with a polygon shapefile and then adds the features from it to a graphicsLayer, and then zooms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I want to be able to do is put all of these polygons together somehow into something so that I can use all of them for the clip!&amp;nbsp; I need to get the graphics from graphicsLayer (from the shapefile code) into my clipGraphicsArray somehow.&amp;nbsp; I've tried a couple of different things, but they do not work.&amp;nbsp; Incidentally, I haven't even been able to feed the shapefile graphics alone into the doClip() function to use them for the clip.&amp;nbsp; So, if someone knows even how to do that, maybe I could hack out the rest on my own.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know how I should go about doing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Here's all the relevant code:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private var clipGraphicsArray:Array;

private function init():void
{ 
 clipGraphicsArray = [];&amp;nbsp; 
}

private function drawClipPoly(event:MouseEvent):void
{
 clipDrawToolbar.activate(DrawTool.POLYGON, true);
}

private function clipDrawEndHandler(event:DrawEvent):void
{
 clipGraphicsArray.push(event.graphic);
 clipGraphicsLayer.add(event.graphic);
}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the shapefile code.&amp;nbsp; It seems like I need to get the graphics from graphicsLayer and somehow push/add them to my clipGraphicsArray, but I just can't figure it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function loadShapefile(shpByteArray:ByteArray, dbfByteArray:ByteArray):void
{
 var index:int = 0;
 const array:Array = [];
 const shpReader:ShpReader = new ShpReader(shpByteArray);
 const dbfHeader:DbfHeader = new DbfHeader(dbfByteArray);
 while (shpReader.hasMore())
 {
&amp;nbsp; var shpPolygon:ShpPolygon = shpReader.readShpPolygon();
&amp;nbsp; var dbfRecord:DbfRecord = DbfTools.getRecord(dbfByteArray, dbfHeader, index++);
&amp;nbsp; // Now takes _all_ attributes
&amp;nbsp; array.push(new Graphic(shpPolygon, shpSymbol, dbfRecord.values)); 
 }
 
 graphicsLayer.graphicProvider = new ArrayCollection(array);
 map.extent = shpReader.extent.expand(1.5);
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code is triggered by a button click once the user has selected the download layers and drawn polygon(s):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function doClip():void
{
 clipDrawToolbar.deactivate();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 
 var myEmail:String = inputEmail.text;
 var featureSet:FeatureSet = new FeatureSet(clipGraphicsArray);
 var params:Object = 
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "Area_To_Download": featureSet,
&amp;nbsp;&amp;nbsp; "Layers_to_Download" : { "features"&amp;nbsp; : [
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow1, "DownLoad" : Row1}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow2, "DownLoad" : Row2}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow3, "DownLoad" : Row3}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow4, "DownLoad" : Row4}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow5, "DownLoad" : Row5}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow6, "DownLoad" : Row6}}
&amp;nbsp;&amp;nbsp; ]},
&amp;nbsp;&amp;nbsp; "Email_address_to_send_zip_file": myEmail
&amp;nbsp; };&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 gp.submitJob(params);
} &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Oct 2010 19:34:41 GMT</pubDate>
    <dc:creator>MelonyBarrett</dc:creator>
    <dc:date>2010-10-20T19:34:41Z</dc:date>
    <item>
      <title>Append or merge or move or copy graphic(s) or featureset(s) or array(s) or ?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/append-or-merge-or-move-or-copy-graphic-s-or/m-p/28977#M676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have set up a clip and ship geoprocessing service.&amp;nbsp; The way it works is the user checks a box for each layer they want to download, and then they draw a single polygon or multiple polygons.&amp;nbsp; After each polygon is drawn the resulting graphic is pushed to an array, and then added to a graphicsLayer.&amp;nbsp; Finally when the user pushes the a button, the array of graphics is passed to a function that creates a FeatureSet from it and then sends it on to the geoprocessing service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Independently of this code, I have implemented code for shapefile overlay which ultimately takes a zipfile containing all the files associated with a polygon shapefile and then adds the features from it to a graphicsLayer, and then zooms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I want to be able to do is put all of these polygons together somehow into something so that I can use all of them for the clip!&amp;nbsp; I need to get the graphics from graphicsLayer (from the shapefile code) into my clipGraphicsArray somehow.&amp;nbsp; I've tried a couple of different things, but they do not work.&amp;nbsp; Incidentally, I haven't even been able to feed the shapefile graphics alone into the doClip() function to use them for the clip.&amp;nbsp; So, if someone knows even how to do that, maybe I could hack out the rest on my own.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know how I should go about doing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Here's all the relevant code:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private var clipGraphicsArray:Array;

private function init():void
{ 
 clipGraphicsArray = [];&amp;nbsp; 
}

private function drawClipPoly(event:MouseEvent):void
{
 clipDrawToolbar.activate(DrawTool.POLYGON, true);
}

private function clipDrawEndHandler(event:DrawEvent):void
{
 clipGraphicsArray.push(event.graphic);
 clipGraphicsLayer.add(event.graphic);
}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the shapefile code.&amp;nbsp; It seems like I need to get the graphics from graphicsLayer and somehow push/add them to my clipGraphicsArray, but I just can't figure it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function loadShapefile(shpByteArray:ByteArray, dbfByteArray:ByteArray):void
{
 var index:int = 0;
 const array:Array = [];
 const shpReader:ShpReader = new ShpReader(shpByteArray);
 const dbfHeader:DbfHeader = new DbfHeader(dbfByteArray);
 while (shpReader.hasMore())
 {
&amp;nbsp; var shpPolygon:ShpPolygon = shpReader.readShpPolygon();
&amp;nbsp; var dbfRecord:DbfRecord = DbfTools.getRecord(dbfByteArray, dbfHeader, index++);
&amp;nbsp; // Now takes _all_ attributes
&amp;nbsp; array.push(new Graphic(shpPolygon, shpSymbol, dbfRecord.values)); 
 }
 
 graphicsLayer.graphicProvider = new ArrayCollection(array);
 map.extent = shpReader.extent.expand(1.5);
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code is triggered by a button click once the user has selected the download layers and drawn polygon(s):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function doClip():void
{
 clipDrawToolbar.deactivate();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 
 var myEmail:String = inputEmail.text;
 var featureSet:FeatureSet = new FeatureSet(clipGraphicsArray);
 var params:Object = 
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "Area_To_Download": featureSet,
&amp;nbsp;&amp;nbsp; "Layers_to_Download" : { "features"&amp;nbsp; : [
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow1, "DownLoad" : Row1}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow2, "DownLoad" : Row2}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow3, "DownLoad" : Row3}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow4, "DownLoad" : Row4}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow5, "DownLoad" : Row5}},
&amp;nbsp;&amp;nbsp;&amp;nbsp; {"attributes" : {"LayerName" : strRow6, "DownLoad" : Row6}}
&amp;nbsp;&amp;nbsp; ]},
&amp;nbsp;&amp;nbsp; "Email_address_to_send_zip_file": myEmail
&amp;nbsp; };&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 gp.submitJob(params);
} &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 19:34:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/append-or-merge-or-move-or-copy-graphic-s-or/m-p/28977#M676</guid>
      <dc:creator>MelonyBarrett</dc:creator>
      <dc:date>2010-10-20T19:34:41Z</dc:date>
    </item>
  </channel>
</rss>

